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
Improve exception message if MultipartParser can not find end of body #28067
Comments
That's Spring Boot 2.6.2, so Spring Framework 5.3.14. I think this issue might related to #27939, which was fixed in Spring Framework 5.3.16 and will be in Spring Boot 2.6.4, due out this Thursday. If you want to try the fix now, you can upgrade to Spring Boot 2.6.3, and set the |
With the mentioned versions experiencing some other error Is multipart upload dependent with server connection time out, initially i got 504 error then tried with10kb file then noticed decoding error
|
In an earlier comment (now deleted) I wrote that I could reproduce this, but I was wrong. Uploading multipart data from Chrome works fine for me. From your comments I gather that both the So if you'd like us to spend some time investigating, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem. |
We are having this issue only in non prod environments. Its happening in when service deployed in docker containers in linux environments. In local its working. Is any decoding configuration or server level configuration required? |
No additional configuration should be required, given that the size of the files you are sending are not that large (178,351 bytes, looking at the It's interesting that the bug only occurs in production. That would suggest that the HTTP headers or body are manipulated somehow in this environment. |
|
@bsreddy125 I faced a similar issue, where locally (Windows) it worked fine, but the same code remotely on a linux machine throwed an "org.springframework.core.codec.DecodingException: Could not find end of body". Given however, this behavior was observed during an integration test and not in production (i.e. with synthetic data). The SetupA total of 3 application are involved:
An important detail is that locally I'm working on Windows and Docker Desktop (enables docker under Windows). (Disclaimer: This was my setup, you can achieve the error without a wiremock!) Reason for the ErrorThe multipart data that the unit test used was created under Windows, which per default uses CRLF for line breaks. This is also how line breaks have to be implemented in multipart data according to RFC. This is also what the Unfortunately I didn't realize, that Git was set up to automatically change in CRLF to linux style LF (here is a SO answer that explains this very nicely). In short, the test data with which the mock was fed was different locally and remotely on linux:
How to Bypass the Error
You could fix this in more than the suggested ways honestly. It could as well be, that you have a similar, but not necessarily identical, issue @bsreddy125. Suggestion for SpringRegardless of whether OP has the same issue, I think it would be at least appreciated, if the exception details could hint a possible issue regarding line breaks. If not a single CRLF was found, chances are the data is corrupt, especially if LFs are available. I spent days looking for the error. However, I don't think this is an issue on Springs end to be honest. |
Facing the same issue on MacOS local for a pdf file. Not sending the Content-Type header through postman, it is automatically adding that. |
Resolved by changing the exception message so that it shows the exact string that the multipart parser is looking for (i.e. |
Parts coming as null, where as same working when uploading from postman, but it failing from angular/chrome agent and verified the request b/w postman and chrome both are similar
Code:
Parts coming as null, where as same working when uploading from postman, but it failing from angular/chrome agent and verified the request b/w postman and chrome both are similar
Postman Request:
Chrome Request:
Service configuration:
With SynchronossPartHttpMessageReader parts coming as null from angular where as same working from postman.
DefaultPartHttpMessageReader giving decoding exception could not find end of the body where as same working from postman
The text was updated successfully, but these errors were encountered: