-
-
Notifications
You must be signed in to change notification settings - Fork 952
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
Multipart resolver exception handling doesn't appear to work #10928
Comments
For context, my sample project is an updated version of @jameskleeh's post here: https://stackoverflow.com/questions/29845943/grails3-file-upload-maxfilesize-limit/32974072#32974072 |
Via @graemerocher, a partial solution is to set the response status to 413 in the controller.
This works... sometimes. It appears to resolve the issue on Chrome and Safari, on macOS. However, Firefox on macOS exhibits the same issue (blank page, "connection was reset" message). What's worse, both Chrome and Firefox on Linux (Ubuntu) continue to display the problematic behavior. I'm told the same is true on Windows. This is entirely specific to the browser/OS - for example, when the test app is deployed to Tomcat on a remote server (ruling out any development environment specifics), a client on macOS/Safari will receive the correct response (form with an error message), and a client on Ubuntu/Chrome will receive the blank page/connection error. I'm not sure how to debug this further. |
@ZacharyKlein @jameskleeh I am not able to replicate this issue on Mac with Chrome, Firefox, and Safari. It seems to be happening in Linux. I do not have a Linux machine. So, I would request you to please assign it to someone with Linux machine. |
ok, I am able to replicate the problem on VirtualBox Linux and on MacOS as well when I try to upload a file with size 20M or more. It seems like it's related to the Tomcat default connector I found similar old issue #9378 which is marked as won't-fix. This is how you do it in a Grails/Spring Boot application: http://stackoverflow.com/questions/32250030/setting-a-tomcat-property-using-spring-boot-application-properties |
@ZacharyKlein I'm getting an exception before reaching the controller, where do you put that code? |
The issue is not about setting the max size, is about how to manager the exception when the max size is reached in a graceful manner so the user is not bothered, since for every max size set a user can upload a bigger file. The exception happens in Spring, before the Grails controllers are reached, so it doesn't seem possible to catch the exception from Grails and return a friendly error to the user. IMO this is a pretty basic problem, not sure why this wasn't fixed, or at least why a strategy to deal with this wasn't documented in Grails. Would be nice is some Grails core member can give a proper solution to this issue any app that allows uploading files will face. |
Hitting this issue as well. Was there any view on how this can even be worked around? Throwing a 500 isn't particularly elegant or user friendly... Thanks |
Steps to Reproduce
maxUploadSize
andmaxRequestSize
config valuesStandardMultipartResolver
and wire inresources.groovy
Expected Behaviour
The request should return a response to the browser, with the appropriate session variable set
Actual Behaviour
The browser never receives a response and errors out with "server connection was reset" message.
Environment Information
Example Application
The text was updated successfully, but these errors were encountered: