3 suggestions
Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.
Optional improvements
[suggestion] · The request deadline disconnects slow, progressing uploads
A valid request that takes longer than -rpcservertimeout to upload is disconnected even if bytes keep arriving; how often supported deployments are affected is unconfirmed.
Location: src/httpserver.cpp:1248 (head).
Details and suggested fix
ReadRequest() starts m_request_since when the first request byte arrives and clears it only after the full body is loaded. MaybeDisconnect() disconnects the client when that deadline expires, even if the upload is still making progress. Previously, only inactivity was timed out.
By default, the request line, headers, and body must arrive within about 30 seconds. A 32 MiB body requires roughly 1.1 MiB/s; a full-size block submitted as about 8 MB of hex requires roughly 270 KB/s. A remote RPC client on a slower link, including through an SSH or Tor tunnel, can therefore be disconnected mid-upload without receiving an HTTP status. The only workaround is the debug-only -rpcservertimeout; raising it also lengthens the idle timeout, and its help text does not explain the total-upload deadline.
Please clarify in the option help and release notes if the fixed total-time limit is intended. If slow uploads should remain supported, one option is to apply a fixed deadline only to the request line and headers, which are bounded by MAX_HEADERS_SIZE, and enforce a minimum body progress rate. That would reject a one-byte trickle, but a client sending just above the minimum rate could hold a connection slot for about MAX_BODY_SIZE / rate. No data on real RPC upload sizes or link speeds was found, so the practical impact is unconfirmed.
[suggestion] · Complete unauthenticated requests can still hold every connection slot
The deadline stops byte trickles, but unauthenticated clients can still occupy all connection slots by sending complete requests; this residual path predates the change.
Location: src/httpserver.cpp:1275 (head).
Details and suggested fix
A client can keep a connection open by sending a minimal complete request, such as GET / HTTP/1.1\r\n\r\n, more frequently than the -rpcservertimeout interval. HTTPReq_JSONRPC() responds with 405, or 401 for a POST without Authorization. HTTP/1.1 replies keep the connection open by default unless the request includes Connection: close. Sending the reply resets m_idle_since, and parsing a complete request clears m_request_since, so neither timeout expires.
Any process that can reach the RPC port can therefore hold all -rpcmaxconnections slots, 16 by default, without credentials. bitcoin-cli then waits in the accept queue, as it does with the trickle case. The existing idle-timeout test also shows that an unauthenticated 404 leaves the connection open. The change closes the trickle variant, but not the broader complete-request behavior described in the PR.
Either narrow the description to the trickle variant or close connections after replies sent before authentication succeeds, including the 405 and 401 from HTTPReq_JSONRPC() and the unregistered-path 404. That would limit each unauthenticated connection to about one timeout interval. WriteReply() currently derives keep-alive behavior from the request headers, so handlers need a way to force closure. Closing every 404 would also affect authenticated callers because RPC_METHOD_NOT_FOUND maps to 404; with -rest enabled, unauthenticated REST endpoints would still permit this pattern.
[suggestion] · The unit test does not verify that parsing clears the deadline
The busy-worker exemption masks the deadline-clearing case, so it would pass even if m_request_since.reset() were removed.
Location: src/test/httpserver_tests.cpp:842 (head).
Details and suggested fix
In the second block of http_request_deadline_tests, TryReadRequest() returns the parsed request and sets m_req_busy = true. The test drops the request without replying; only Send() clears that flag, and HTTPRequest has no destructor that does. Both is_idle and is_stalled require !m_req_busy, so the MaybeDisconnect(expired, ...) check returns false regardless of whether m_request_since is set. The third block intentionally tests that same exemption.
If the reset at httpserver.cpp:1275 regressed, a keep-alive client would carry the first request's deadline forward and could be disconnected after a slow RPC reply or during a later request. No unit case would catch this, although check_server_busy_idle_timeout() probably would at the functional level. Add a protected test accessor next to SetRequestSince() that reports whether the deadline is armed, then assert that it is false after parsing a complete request.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Compute the expiration time after arming the deadline