-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Request Body Size Limit? #1733
Comments
OK, apparently the problem is Flask's inability to handle chunked data: https://medium.com/@DJetelina/python-and-chunked-transfer-encoding-11325245a532 As noted in #1264, Django has a similar problem. Ugh. EDIT: And more to the point, see #1653. |
For anyone else experiencing this problem with a Flask app, adding this function to the app code (note the "before_request" decorator) fixes it:
|
I believe the content of this ticket is different from the title. Rename? Also, chunked data support is handled in #1653. Close this one? |
On the other hand, I would like to ask clarification on body size: Actually, I asked also about it #1659 but I'm not sure I understand. In a nutshell, my conclusion there was that (using Flask):
If my second bullet is correct, then |
|
Ok, so if gunicorn doesn't buffer it, werkzeug (or Flask) still might. I thought I could assume that werkzeug is smart enough to check |
we now support |
I've got a Flask application doing natural language processing (NLP), and it accepts a request body consisting of a JSON array of tokens (words). Thus, a document 400 words long become an array of length 400, and so on.
When I pass in an array longer than about 8K characters (including the commas and such), I get no error whatsoever in the gunicorn log, but the request passed to the API is completely empty. If I pass in a smaller document, I have no problem. If I run the app with werkzeug.serving.run_simple rather than gunicorn, I have no problems with long documents.
I've had a look at #376 and #1659, and judging by the response to #1659, the request body shouldn't be limited at all. Nonetheless, I added the following to my config file:
limit_request_line = 0
limit_request_fields = 32768
limit_request_field_size = 0
The new lines in the config don't help. That fact suggests that this is a different issue from #1704, since I can't get my app to work even with values of unlimited (0) for the two settings that allow that--and at any rate, I'm not getting the "Bad Request" error I've seen referenced elsewhere (I don't recall where).
Thanks for any help you can provide.
The text was updated successfully, but these errors were encountered: