bitreq::Client caches Arc<AsyncConnection> by host+port in a HashMap and
never evicts an entry, never revalidates before reuse, and never replaces an
entry on error. Once a pooled socket is dead (e.g. closed by the peer after an
idle timeout, or reset), the pool hands out the same dead Arc to every
subsequent caller for that key, permanently — until the process restarts.
Because send_async returns the underlying error to the caller without
touching the pool, retry logic in downstream crates is defeated: each retry
calls send_async again, gets the same Arc<AsyncConnection> back, and fails
on the same dead socket.
We hit this in a bitcoin RPC client (bitcoind-async-client 0.10.x, which now
uses bitreq) talking to a local bitcoind. After ~30 seconds of idle, bitcoind
closes the RPC socket per its rpcservertimeout. The next request fails, and
then all subsequent requests fail indefinitely — even though a fresh TCP
connection to the same port succeeds instantly. Only restarting the client
process recovers.
bitreq 0.3.4 (latest as of writing)
- observed via
bitcoind-async-client 0.10.2 against bitcoind 29.x on Linux
bitreq::ClientcachesArc<AsyncConnection>by host+port in aHashMapandnever evicts an entry, never revalidates before reuse, and never replaces an
entry on error. Once a pooled socket is dead (e.g. closed by the peer after an
idle timeout, or reset), the pool hands out the same dead
Arcto everysubsequent caller for that key, permanently — until the process restarts.
Because
send_asyncreturns the underlying error to the caller withouttouching the pool, retry logic in downstream crates is defeated: each retry
calls
send_asyncagain, gets the sameArc<AsyncConnection>back, and failson the same dead socket.
We hit this in a bitcoin RPC client (
bitcoind-async-client0.10.x, which nowuses bitreq) talking to a local
bitcoind. After ~30 seconds of idle, bitcoindcloses the RPC socket per its
rpcservertimeout. The next request fails, andthen all subsequent requests fail indefinitely — even though a fresh TCP
connection to the same port succeeds instantly. Only restarting the client
process recovers.
bitreq0.3.4 (latest as of writing)bitcoind-async-client0.10.2 againstbitcoind29.x on Linux