Reset c->pipeline on the keepalive path - #1600
#1600Draft
VadimZhestikov wants to merge 1 commit into
nginx:masternginx/nginx:masterfrom
VadimZhestikov:fix/keepalive-reset-pipelineVadimZhestikov/nginx:fix/keepalive-reset-pipelineCopy head branch name to clipboard
Draft
Reset c->pipeline on the keepalive path#1600VadimZhestikov wants to merge 1 commit intonginx:masternginx/nginx:masterfrom VadimZhestikov:fix/keepalive-reset-pipelineVadimZhestikov/nginx:fix/keepalive-reset-pipelineCopy head branch name to clipboard
VadimZhestikov wants to merge 1 commit into
nginx:masternginx/nginx:masterfrom
VadimZhestikov:fix/keepalive-reset-pipelineVadimZhestikov/nginx:fix/keepalive-reset-pipelineCopy head branch name to clipboard
Conversation
c->pipeline is set when a pipelined request is read from the connection buffer, and it is used later to force lingering close in ngx_http_finalize_connection(). It was never cleared when a new request begins on a kept-alive connection, so the flag could persist and cause an unnecessary lingering close for a subsequent request that was not pipelined. Reset c->pipeline in ngx_http_keepalive_handler() alongside the existing c->sent and c->destroyed resets, restoring its intended present-tense meaning. Reported by fdgnneig.
VadimZhestikov
force-pushed
the
fix/keepalive-reset-pipeline
branch
from
July 22, 2026 23:15
3b1a40a to
11f3ae3
Compare
VadimZhestikov
marked this pull request as draft
July 22, 2026 23:26
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.
Problem
c->pipelineis set to1inngx_http_set_keepalive()when apipelined request is present in the connection buffer, and it is read in
ngx_http_finalize_connection()as one of the conditions that forces alingering close.
The flag is never cleared when a new request starts on a kept-alive
connection (
ngx_http_keepalive_handler()resetsc->sentandc->destroyed, but notc->pipeline). As a result the flag can persistacross the keepalive boundary and trigger an unnecessary lingering close
for a later request that was not actually pipelined.
Fix
Reset
c->pipeline = 0inngx_http_keepalive_handler()alongside theexisting
c->sent/c->destroyedresets, restoring the flag's intendedpresent-tense meaning.
Impact is limited to a needless lingering close (no memory-safety or
security effect); this is a correctness cleanup.
Testing
Builds cleanly (
--with-http_ssl_module --with-stream --with-stream_ssl_module --with-debug); no new warnings.