httpd/koji: set MaxKeepAliveRequests 0 to fix 502 race condition #3213
No reviewers
Labels
No labels
ai-review-please
freeze-break-request
post-freeze
Backlog Status
Needs Review
Backlog Status
Ready
chore
documentation
points
01
points
02
points
03
points
05
points
08
points
13
Priority
High
Priority
Low
Priority
Medium
Sprint Status
Blocked
Sprint Status
Done
Sprint Status
In Progress
Sprint Status
Review
Sprint Status
To Do
Technical Debt
Work Item
Bug
Work Item
Epic
Work Item
Spike
Work Item
Task
Work Item
User Story
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
infra/ansible!3213
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "victorkoycheff/ansible:issue-12913-koji-502"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR is the second (and final) half of the fix for the Koji 502 Bad Gateway errors reported in #12913.
What was happening:
My previous PR (#3173) added
ttl=10to the proxyopts. That successfully fixed the idle timeout race condition, but people were still occasionally hitting 502s under heavy load.Turns out there was a second race condition at play: the request count limit. The backend Apache configurations (
httpd.conf.j2,kojiweb.conf.j2) hadMaxKeepAliveRequests 500hardcoded. If a client polled aggressively enough (bypassing the 10-second idle TTL), the proxy would reuse the same connection until it hit exactly 500 requests. At that moment, the backend Apache server would ruthlessly close the TCP connection. If the proxy tried to hand off request #501 at that exact millisecond, we'd get a 502.The Fix:
This PR sets
MaxKeepAliveRequests 0(unlimited) on the proxy and Koji hub/web templates.By removing the request limit on the backend, we ensure the backend never hangs up on the proxy unexpectedly. The
ttl=10setting from the previous PR remains in place and now functions perfectly as the sole lifecycle manager for these connections, gracefully closing them only when they are genuinely idle.Testing:
I verified this locally using a Python script built to spam the
helloendpoint. Without this fix, the script reliably hits a 502 between 500-1500 requests.Fixes #12913
cd59b81cfcc686b58853So, I am not convinced that this will fix the underlying issue.
However, I am willing to give it a try now that we are out of freeze.