feat(agent): friendly 504 page for paused/timing-out upstreams - #438
Open
runleveldev wants to merge 2 commits into
Open
feat(agent): friendly 504 page for paused/timing-out upstreams#438runleveldev wants to merge 2 commits into
runleveldev wants to merge 2 commits into
Conversation
…eams A frozen (cgroup.freeze) or OOMing-but-alive container keeps its TCP socket open but never responds, so NGINX hits proxy_read_timeout and returns a bare 504 Gateway Timeout. Only a 502 page existed. - Add error-pages/504.html (paused/under-load messaging), styled to match the existing pages. - Wire it via error_page 504 in the agent nginx template alongside the existing 502 handling (default server, per-service, and bare-domain blocks) plus the internal error-pages socket server. - Clarify 502 copy as connection-refused (stopped/crashed) so 502 vs 504 read distinctly for the memory-thrash case. Part of #431. Closes #435
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a dedicated friendly 504 Gateway Timeout error page and wires it into the agent-generated NGINX config so paused/frozen or timing-out upstream containers render a styled, explanatory page (consistent with existing 502/503 handling and styling).
Changes:
- Introduces
error-pages/504.html(“Service Paused”) styled to match existing error pages. - Updates
agent/templates/nginx.conf.ejsto route 504s through the internal error-pages socket server (mirroring the existing@502pattern). - Refines
error-pages/502.htmlcopy to better align with “connection refused / stopped” semantics.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| error-pages/504.html | New friendly 504 page with consistent styling and explanatory troubleshooting text. |
| error-pages/502.html | Updates 502 message copy to distinguish it from 504 timeout scenarios. |
| agent/templates/nginx.conf.ejs | Adds error_page 504 @504 handling and serves /504.html via the internal error page server. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a friendly 504 error page for frozen/paused or OOMing-but-alive containers.
When a container is frozen (
cgroup.freeze) or OOMing but still alive, it keeps its TCP socket open but never responds. NGINX then hitsproxy_read_timeoutand returns a bare 504 Gateway Timeout — distinct from a stopped/crashed container, which refuses the connection and yields 502. Previously only502.htmlexisted, so a paused/slow upstream produced an unstyled 504.Part of #431 (memory-exhaustion thrash). Closes #435.
Changes
error-pages/504.html— new page ("Service Paused") explaining the app is paused/under heavy load and should return shortly. Styled to match the existing error pages (dark gradient, grid overlay, glass card, JS-injected hostname); uses an amber/gold gradient to read distinctly from 502 (blue/purple) and 503 (orange/red).agent/templates/nginx.conf.ejs— wireserror_page 504 @504following the established@502pattern in every server block that already handles 502 (default HTTPS server, per-service blocks, bare-domain docs server), and addslocation /504.html { }to the internal error-pages socket server.error-pages/502.html— copy revised to connection-refused semantics ("the upstream refused the connection… likely stopped or has crashed") so 502 vs 504 read sensibly for the memory-thrash case.No packaging changes needed:
agent/Makefilealready globserror-pages/*into/opt/opensource-server/error-pages/.Acceptance criteria
error-pages/styling.Verification
Rendered
nginx.conf.ejsvia EJS across service permutations (no services, plain HTTP, auth+server, auth-no-server, external domains) — all render successfully with the correct number oferror_page 504/location @504blocks and the socket-serverlocation /504.html.nginx -twas not run here (nginx isn't installed in this environment); the agent already runs a config test with rollback on apply, and the 504 wiring mirrors the proven 502 blocks verbatim.