You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
Behavior changes: read before upgrading
least_time header inflight counts the time of the header in an upstream block with mruby_upstream_keepalive
Before: with nginx 1.31 built with --with-http_ssl_module, nginx did not count the time to receive the header of a response for the servers of an upstream {} block with least_time header inflight and mruby_upstream_keepalive. When requests came one after another to two servers, the one that sends its header after a second got as many of them as the one that answers at once.
Now: nginx counts that time, and prefers the server with the least time, as it does with its own keepalive directive.
Why it changed:
The defect: least_time header inflight takes the time of the header from the call that nginx makes to the peer of an upstream when the header of a response has arrived (peer.notify). mruby_upstream_keepalive puts functions of its own in the place of those of the peer and had none for this call, so least_time did not count the time.
Why the old behavior could not be kept: the same call is what requests need that got no response (the first entry of "Fixes" in the release notes). Once mruby_upstream_keepalive passes it on, least_time counts the time.
What the documentation promised: nginx's documentation of least_time says that a request is passed to the server with the least average response time and the least number of active connections, and that with the parameter header the time to receive the response header is used. mruby_upstream_keepalive is documented as the same as nginx's keepalive, with which nginx counts the time.
Affected: upstream {} blocks with least_time header inflight and, after it, mruby_upstream_keepalive, in nginx 1.31 built with --with-http_ssl_module. least_time without inflight or with last_byte does not use the call and is the same as before.
What to do: nothing where the block is meant to prefer the faster server. A block that should not take the time of the header into account needs another load balancing method, for example least_conn.
mruby_upstream_keepalive does not keep an upstream connection whose request body was not fully sent
Before: an upstream {} block with mruby_upstream_keepalive kept an upstream connection in its pool, to reuse for a later request, even when nginx had sent the response before it finished sending the request body to that upstream.
Now: mruby_upstream_keepalive closes such a connection instead of keeping it, as nginx's own keepalive directive does.
Why it changed:
The defect: an upstream connection whose request body nginx had not finished sending was kept and reused for a later request. When it was reused, the upstream could read bytes of the earlier request's body as the beginning of the later request, which may come from a different client; GHSA-qq6c-wv62-6wjh has the details.
Why the old behavior could not be kept: nginx's keepalive does not keep such a connection, so the fix closes it the same way; nginx's keepalive has closed it since nginx 1.9.10.
What the documentation promised: mruby_upstream_keepalive is documented as the same as nginx's keepalive, which does not keep such a connection (nginx's keepalive).
Affected: upstream {} blocks with mruby_upstream_keepalive whose upstream sends the response before nginx finishes sending the request body. A block whose upstream reads the whole body before it responds, or closes the connection, is unchanged.
What to do: nothing; rebuild with this release.
mruby_upstream_keepalive does not keep an upstream connection it cannot shut down in a module built without SSL
Before: a module built with --with-compat and without --with-http_ssl_module, loaded into an nginx that has SSL, kept an upstream connection of an https upstream of a block with mruby_upstream_keepalive in its pool, to reuse for a later request, although it could not shut that connection's SSL down when it later closed it.
Now: mruby_upstream_keepalive does not keep such a connection in such a build; nginx opens a new connection to the https upstream for each request and closes each one, with its SSL object, itself. A module built with the same SSL options as nginx is unchanged.
Why it changed:
The defect: in a module built without SSL, a cached https upstream connection was closed without its SSL being shut down. This release also lets such a build answer the https upstream requests of a block with mruby_upstream_keepalive (the second entry under "Fixes" in the release notes), so these connections reach the cache.
Why the old behavior could not be kept: a module built without SSL cannot call ngx_ssl_shutdown, so it cannot shut such a connection down itself; by not keeping it, it leaves the close to nginx, which does.
What the documentation promised: mruby_upstream_keepalive is documented as the same as nginx's keepalive; nginx's own keepalive shuts an SSL connection down when it closes it.
Affected: a module built with --with-compat and without --with-http_ssl_module and loaded into an nginx that has SSL, with an https upstream of a block with mruby_upstream_keepalive. A build where nginx and the module have the same SSL options is unchanged.
What to do: nothing; rebuild with this release. To reuse TLS connections to an https upstream, build the module with --with-http_ssl_module.