Skip to content

2.3.5

Choose a tag to compare

@github-actions github-actions released this 18 Nov 14:52
· 13 commits to main since this release
768fad4

Security

  • A frontend HTTP/2 stream that Sōzu resets now gives its stream slot back at once. A stream error the client provokes (a malformed request such as a :path carrying a fragment, a body that does not match its content-length, a zero-increment or overflowing WINDOW_UPDATE, a stream made to depend on itself, DATA or HEADERS on a half-closed stream) is answered with RST_STREAM. The stream left the connection's stream table but kept its slot and its two pool buffers until the connection closed. With the default max_buffers = 1000, about 499 such resets on one connection emptied the worker's buffer pool. From then on the worker refused new streams with REFUSED_STREAM for want of buffers, on that connection and on a new connection alike, until the connection closed. The reset now logs the request and recycles its slot, whatever state the stream was in. Access-log timing changes with it: each provoked reset of a request not yet logged now writes its access-log line when the reset happens, so a request rejected at its HEADERS (a malformed :path), or reset after a default answer, is logged H2::Reset at once, where it used to be logged session close when its connection closed. A request reset while waiting for or linked to a backend was already logged H2::Reset, and still is, once. Debug builds now assert after every frame and every read and write pass that no frontend slot is left out of the stream table without being recycled (#1922).

  • A request answered 504 by a timeout no longer leaves its backend connection able to answer another request. On an HTTP/2 frontend the connection outlives the 504, and the client's next request could receive the late response of the request that timed out. Two paths led there, both with an HTTP/1.1 backend that had received the whole request and not answered yet. When back_timeout fired first (the default order, 30 s against a front_timeout of 60 s), the backend connection was returned to the session's keep-alive pool with that request still unanswered on it, so the next request of the session for that backend was written behind it and read its response. When front_timeout fired first (a back_timeout longer than front_timeout), the backend connection, HTTP/1.1 or HTTP/2, stayed attached to the stream slot: the next request reused the slot and received whatever the backend sent later, and a late read or close on a slot the session had since dropped indexed past the stream table and panicked. The mix-up stays inside one client connection, so it crosses users only where an intermediary multiplexes several of them onto it. Both timeout branches of Mux::timeout_inner now end the request on its backend before they install the answer: the HTTP/1.1 connection is closed instead of pooled or left attached, and an HTTP/2 backend stream is reset. A backend that had answered whole is still pooled. An HTTP/1.1 frontend closes after the default 504 (Connection: close) and was not affected with the default answers (#1924).