Skip to content
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

[5.0] fix crash/UB when exceeding http-max-requests-in-flight #2209

Merged
merged 1 commit into from
Feb 5, 2024

Conversation

spoonincode
Copy link
Member

When verify_max_requests_in_flight() indicates we've exceeded max requests in flight, send_busy_response(), via send_response(), queues up an async_write() on the socket. But once this async_write() returns, do_eof() would be called which closes the socket while operations are pending. This causes bad things to happen.

Instead, set the keep_alive(false) on the response, which flags needs_eof() so that,

bool close = !(plugin_state_->keep_alive) || res_->need_eof();

will be set to true, which means the socket will be properly disposed of once the async_write() completes,
if(close) {
// This means we should close the connection, usually because
// the response indicated the "Connection: close" semantic.
return do_eof();
}

@spoonincode spoonincode merged commit 6e3c378 into release/5.0 Feb 5, 2024
29 checks passed
@spoonincode spoonincode deleted the max-requests_fix_50 branch February 5, 2024 22:21
@ericpassmore
Copy link
Contributor

Note:start
group: STABILITY
category: BUG
summary: Guard against errors when exceeding http-max-requests-in-flight
Note:end

@bhazzard bhazzard added this to the Leap v5.0.1 milestone Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants