-
Notifications
You must be signed in to change notification settings - Fork 98
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
Incorrect parsing of multipart data results in unfilled form parameters and NPE in logs #291
Comments
Trying to debug this myself. |
Do you have any test data you can share that replicates the issue? |
Couldn't share the original data but managed to reproduce the issue with some completely random data. Note that it's rather sensitive to the sizes.
The files themselves: files.zip |
Huh, it's not that rare actually - I just encountered it 3 more times with different data.
But the initial error is still there in the stack traces as well, so I don't really think that the "No end delimiter" is really relevant. |
@malcolmsparks I think this line https://github.com/juxt/yada/blob/master/ext/multipart/src/yada/multipart.clj#L187 should use |
Clarification: I'm seeing similar symptoms with version 1.2.15 and 1.2.16. @p-himik I suspect I'm running into this exact issue as well. It seems to trigger more often with certain arg combinations, and for certain combos it fails 50% of the time locally, 100% of the time on our server. It definitely smells like a concurrency issue of some sort. Did ya' try out that change that you suggested? |
@leguma Yep, so far so good since I've created this issue. I just copied the file into the source directory of my own project and modified it there. The classpath preference makes sure that it's the one that's used instead of the yada's original one. |
@p-himik I verified that fixing that line worked! In case someone wants some reproduction information, here's a bunch of tests I ran attempting to isolate the issue: It can be difficult to reproduce with a universal set of args since it seems very platform specific, but you should be able to do so with some tinkering. I'll submit a PR with the fix, since I don't see one submitted yet for some reason. For anyone coming in before it's in a stable release, modify the line that @p-himik mentioned (pass in I think the issue has something to do with multipart chunking coming in different orders sometimes? Example good and bad slices it's trying to parse: Failure: Success: When it goes to grab info from those parsed headers, it grabs first and second elements, which are obviously wrong in the failure example. |
This is good news. Which platforms are involved? I have been unable to replicate the issue on Linux, but very happy to review/merge a PR |
@malcolmsparks I am on Linux as well, I was able to replicate it locally and on Heroku. But as I mentioned on Gitter, I was unable to make a reliable test case. |
That's useful info. I'll try to replicate locally in that case. The implementation was subjected to a round of property-based testing but obviously that didn't catch this. |
But I think that the fix that I've come up with can and should be implemented even if it proves impossible to create a robust test case. After all, |
Yes I agree. |
It happens on any platform. I've reproduced it in a Linux docker image, a Windows machine, and on OSX. As ya' can see from the tests I ran, the order and size of the files seem to matter, as well as some fuzziness caused by environment-specific stuff. I have reproduced it with XHR and Postman. The only pattern that I can immediately point to is "large" files followed by "small" ones may somehow be a trigger. Try using 4+ files of differing sizes and juggling them around until you trip the switch. |
@malcolmsparks Wanna review #303? It should take all of 10 seconds. :) |
yada
1.3.0-alpha10.Take a look at this:
I don't think I can provide you the data itself, but let me know if I can provide anything else.
The text was updated successfully, but these errors were encountered: