-
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
nginx config fastcgi_request_buffering breaks streaming / chunked transfer encoding #9574
Comments
Efforts to remove php-fpms limitation have failed, see php/php-src#7509 |
I'm not certain of the right path either. 😂 With a lot of these large file transfer matters the most honest answer comes down to: "It depends." :-) My understanding is that having this particular parameter I don't believe My hot take is that if we change it in the example config, then the only thing we're gaining is a different group of people requesting we toggle it the other way in six months. :-) Another option, if neither on nor off is ideal for someone, is to use Apache + php-fpm or mod_php (at least for the app server; this isn't relevant to using NGINX solely as an RP). Which is the recommended deployment anyhow. There's always room for better documenting this stuff though. So maybe the answer is: let's try to document the trade-offs of this particular switch today and fight the other battles tomorrow. :-) Perhaps we can start by figuring out how to make the situation you ran across recognizable by a reader. In that way they can then discover this option, and tweak it in their environment to see if it makes any difference for their use case. How would you describe the symptoms you encountered - before changing the value of this parameter - in a couple sentences? |
I agree that it doesn't make sense to change the example if the implication isn't clearly understood. I'll try to get a minimal reproducing setup to share and clarify the symptoms - this may take some time though. Since I fixed it for my setup, my priorities are currently elsewhere. |
I ran some tests on a local docker deployment:
The nginx.conf file is roughly what was proposed in the admin guide (but I can't verify it right now, because it's down). I ran DAV file uploads with curl:
Both HTTP requests will be answered with 204 No Content, but the first one (which does not use chunked transfer encoding but instead has content-length set) results in the full file uploaded, while the second one (using chunked transfer encoding, no content-length) results in a 0-byte file. I expect the same behavior on any Android application using pipes, for example DAVx5, when using the Android standard ContentProvider file upload interface. I think the exact behavior that a user sees will depend various factors (such as buffering of the used http client). |
Just to state the obvious: by setting |
Thank both of you for providing the historical context of the issue. I'm here because a severe bug:
It is not about performance, I have no idea what's the best solution. But I do believe this should be escalated and addressed, either in the document or by working it around in Nextcloud's codebase. Maybe just ask users stop using NGINX. |
Related recent change made in |
The admin manual suggests to use
fastcgi_request_buffering off
for nginx configurations. However, this breaks in situations where the Content-Length header is not set (e.g. streaming upload on WebDAV, like DAVx⁵ does).Note that PHP does not plan to change php-fpm's behavior, as the (ancient, unmaintained) FastCGI spec requires the Content-Length header: https://bugs.php.net/bug.php?id=51191
nginx does not care, because it works with enabled buffering: https://trac.nginx.org/nginx/ticket/2287
Symptom analysis here (TL;DR: bigger uploads using DAVx⁵ will always fail): seedvault-app/seedvault#505
My suggestion is to enable
fastcgi_request_buffering
to get this use case to work, but I don't know if anything else depends on disabled buffering.The text was updated successfully, but these errors were encountered: