Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1 RecordingsPostHandler does not delete improperly-named files #784

Closed
andrewazores opened this issue Dec 10, 2021 · 0 comments · Fixed by #787
Closed

V1 RecordingsPostHandler does not delete improperly-named files #784

andrewazores opened this issue Dec 10, 2021 · 0 comments · Fixed by #787
Assignees
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@andrewazores
Copy link
Member

andrewazores commented Dec 10, 2021

Testing it now with your allocation_before_gc_fix.jfr. That should fail to upload to archives because the name pattern doesn't match, but it looks like it gets rejected with a 400 and yet the original UUID-named file corresponding to it is still present on the server. That's a bug in the V1 RecordingsPostHandler. I have renamed it to be similar to one of my other sample recordings that does have the correct name pattern, so now it is janlaw-6f4775cdbf-82dvl_10mb_20211006T152006Z.jfr. I'll see what's going on with this, but it definitely looks like the report generator container is just getting killed and restarted.

Originally posted by @andrewazores in https://github.com/cryostatio/cryostat/pull/779#discussion_r767016577

When a request to POST /api/v1/recordings is made and fails because the uploaded file had an improper file name, then the uploaded file in the file-uploads directory must be deleted from the server. Currently it is left dangling with a generated UUID name.

Reproducer sample:

$ https -f :8181/api/v1/recordings recording@foo.jfr
HTTP/1.1 400 Bad Request
content-encoding: gzip
content-length: 100
content-type: text/plain

Incorrect recording file name pattern caused by HttpStatusException: Bad Request


$ https :8181/api/v1/recordings
HTTP/1.1 200 OK
content-encoding: gzip
content-length: 141
content-type: text/plain

[
    {
        "downloadUrl": "https://localhost:8181/api/v1/recordings/857efa3a-1cab-4354-9720-10b0e125d228",
        "name": "857efa3a-1cab-4354-9720-10b0e125d228",
        "reportUrl": "https://localhost:8181/api/v1/reports/857efa3a-1cab-4354-9720-10b0e125d228"
    }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants