Skip to content

Add more timeout configs in the nginx-root-sample file #13477

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

Merged
merged 2 commits into from
Aug 11, 2025

Conversation

julien-nc
Copy link
Member

@julien-nc julien-nc commented Jul 31, 2025

To later make these timeout values configurable

@MichaIng
Copy link
Member

What issue is this solving? Defaults for all 4 values are 60 seconds: https://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_connect_timeout

Allowing connections resp. individual packets to hang for 1 hour might cause other issues if the backend resp. client remain unresponsive, like max threads/connections running full, connection queries running full, potentially memory issues etc. In slow network environments it might be a workaround to increase these timeouts, so it might be not a bad idea to expose those settings, but I would not implement it with a 60x higher default.

In any case, if wanted, please add those to the sub dir config as well, they should be kept in sync.

@oleksandr-nc
Copy link
Contributor

Can we try first if 30 minutes is enough for very large files? And maybe make an additional comment in docs that this is related for uploading of very large files with webui?

@julien-nc julien-nc force-pushed the enh/noid/nginx-root-sample-more-timeouts branch from 5e0f95a to c95235a Compare July 31, 2025 11:48
@julien-nc
Copy link
Member Author

@MichaIng Thank you for the feedback.

The precise issue that motivates this change is that uploading big files fails with:
1171 upstream timed out (110: Connection timed out) while reading response header from upstream, client: x.x.x.x, server: , request: "MOVE /remote.php/dav/uploads/admin/web-file-upload-5e685f6e7e669798/.file HTTP/1.1", upstream: "fastcgi://x.x.x.x:9000", host: "a.b.c.d"

The root cause might be a slow NFS filesystem. This is indeed a workaround but that might be the only option in some cases.

I've adjusted those values back to their default: 60s. The main goal is to make them configurable in an enterprise-aio setup.

@julien-nc julien-nc force-pushed the enh/noid/nginx-root-sample-more-timeouts branch from c95235a to e5f950b Compare July 31, 2025 11:49
@MichaIng
Copy link
Member

MichaIng commented Jul 31, 2025

And maybe make an additional comment in docs that this is related for uploading of very large files with webui?

According to the docs, these settings are not affecting the max transfer time, but only the time it takes to (re)connect to proxy/client, respectively the time between two packets (read resp write operations). So it is about if backend/client turn unresponsive, how long the connection shall wait idle before giving up.

The precise issue that motivates this change is that uploading big files fails with:

Hmm, and that example was actually hanging for such a long time, or did only the proxy handler expect response headers while the backend was synchronously receiving/writing the large file? Also do really all 4 settings need to be adjusted for this very specific case, or is proxy_connect_timeout alone sufficient (which seems to be the one responsible for the exact error you pasted)?

Maybe this can be better solved in Nextcloud code (mid-term at least). I am no WebDAV expert, but maybe there is a way to send the expected response headers (and in case keep sending some "I am alive" signals) while the backend is waiting for the slow filesystem or while uploads/writes to it are done.

I've adjusted those values back to their default: 60s. The main goal is to make them configurable in an enterprise-aio setup.

Understood. I guess they could be even kept commented by default in this case, so they have a place in the config, but need to be uncommented to override Nginx or parent config defaults.

…nx-subdir.conf.sample files

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
…bdir.conf.sample

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
@julien-nc julien-nc force-pushed the enh/noid/nginx-root-sample-more-timeouts branch from e5f950b to 8486c74 Compare August 4, 2025 12:18
@julien-nc
Copy link
Member Author

julien-nc commented Aug 4, 2025

do really all 4 settings need to be adjusted for this very specific case, or is proxy_connect_timeout alone sufficient (which seems to be the one responsible for the exact error you pasted)

@MichaIng Not knowing that for sure is a good reason IMO to allow the admins to change any of those values in enterprise-aio.

@szaimen Is it fine to have those values commented for the rest of the work in enterprise-aio to have new env vars to set those vaues?

@szaimen
Copy link
Contributor

szaimen commented Aug 11, 2025

@szaimen Is it fine to have those values commented for the rest of the work in enterprise-aio to have new env vars to set those vaues?

yes. It is fine

Copy link
Contributor

@szaimen szaimen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@szaimen szaimen merged commit 713db55 into master Aug 11, 2025
12 checks passed
@szaimen szaimen deleted the enh/noid/nginx-root-sample-more-timeouts branch August 11, 2025 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants