Repository navigation
2.3.5
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
:pathcarrying a fragment, a body that does not match itscontent-length, a zero-increment or overflowingWINDOW_UPDATE, a stream made to depend on itself,DATAorHEADERSon a half-closed stream) is answered withRST_STREAM. The stream left the connection's stream table but kept its slot and its two pool buffers until the connection closed. With the defaultmax_buffers = 1000, about 499 such resets on one connection emptied the worker's buffer pool. From then on the worker refused new streams withREFUSED_STREAMfor 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 itsHEADERS(a malformed:path), or reset after a default answer, is loggedH2::Resetat once, where it used to be loggedsession closewhen its connection closed. A request reset while waiting for or linked to a backend was already loggedH2::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
504by a timeout no longer leaves its backend connection able to answer another request. On an HTTP/2 frontend the connection outlives the504, 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. Whenback_timeoutfired first (the default order, 30 s against afront_timeoutof 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. Whenfront_timeoutfired first (aback_timeoutlonger thanfront_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 ofMux::timeout_innernow 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 default504(Connection: close) and was not affected with the default answers (#1924).