]> git.kaiwu.me - nginx.git/commit
Avoid repeating send_chain() when it sent nothing
authorRoman Arutyunyan <arut@nginx.com>
Tue, 17 Nov 2026 19:02:36 +0000 (23:02 +0400)
committerSergey Kandaurov <pluknet@nginx.com>
Thu, 19 Nov 2026 16:56:13 +0000 (20:56 +0400)
commit2c84628229bdeedd16db5980af6e8fdf754cc80d
tree4e6714918373a3e9adaa642c6f1b3738ced240cb
parent2e8440bcdc438f0f1cd03da778a3843ddb3c86d9
Avoid repeating send_chain() when it sent nothing

Previously, ngx_http_write_filter() re-posted the write event to
continue a capped send whenever output data remained and
c->write->ready was still set.  This was wrong when c->send_chain()
returned without sending anything while the write event still looked
ready, notably when SSL_write() returned SSL_ERROR_WANT_READ.  The
event was then re-posted on every event loop iteration, busy-looping
the worker at 100% CPU.

The implicit progress check was lost in 00f4be1ce (1.21.4).  It is
now restored by requiring that c->send_chain() advanced c->sent.

Reported by yxd05.
src/http/ngx_http_write_filter_module.c