Merge bitcoin/bitcoin#36676: cli: respect -rpcclienttimeout even when sending
What changed, and why it matters
This patch fixes a bug in bitcoin-cli (the command-line tool used to talk to a Bitcoin node) where the -rpcclienttimeout setting was not being respected while sending a request. Previously, if the network socket was not ready to send data, the tool would wait, time out, then silently try again in an infinite loop. Now it correctly gives up and reports failure. This is primarily a reliability and user-expectation bug rather than a direct theft-of-funds vulnerability.
Treat as a low-severity reliability/hardening fix. No emergency response is warranted. Users and downstream packagers should include this patch in their next routine update. Operators relying on -rpcclienttimeout for automation should verify timeout behavior after upgrading.
Security signals we found
Denial-of-service vector: unbounded retry loop on socket wait timeout/error could hang bitcoin-cli indefinitely
Configuration bypass: -rpcclienttimeout was effectively ignored during the send phase
Error-handling hardening: Sock::Wait errors and timeouts are now propagated instead of retried
Regression fix introduced by prior libevent removal
Evidence from the diff
In src/bitcoin-cli.cpp, HTTPClient::SendRequest() uses Sock::Wait() to block until the socket becomes writable before sending an RPC request. A regression from the move away from libevent caused the code to continue looping when Wait() timed out or returned an error without the SendEvent bit set. The fix changes continue to return false, so -rpcclienttimeout is honored and Wait() errors/timeouts are not silently retried forever. The change is small (+2/-1 line) and defensive.
Changed components
src/bitcoin-cli.cppHTTPClient::SendRequest()bitcoin-cli RPC clientInspect captured patch +2 / −1
### src/bitcoin-cli.cpp
@@ -912,8 +912,9 @@ bool HTTPClient::SendRequest(std::string_view request)
return false;
}
+ // The wait either timed out or the socket reported an error without becoming writable.
if (!(event & Sock::SendEvent)) {
- continue;
+ return false;
}
ssize_t sent = m_socket->Send(request.data(), request.size(), MSG_NOSIGNAL);Why this scored 34/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.