http_client: don't arm the timeout of a request that has already failed #184

Merged
vitalif merged 1 commits from koolkhel/vitastor:http-stray-timer into master 2026-11-27 13:38:29 +03:00

1 Commits

Author SHA1 Message Date
c74de4f8b2 http_client: don't arm the timeout of a request that has already failed
A request can fail inside http_request(): connect() refused at once
(ENETUNREACH), socket() failing (EMFILE), TLS setup failing. Its callback
has then already run when send_request() arms the timeout, and the timer
was armed anyway. Nothing cleared it: the next request overwrote its id.
It later failed the client's next request with a false "HTTP request
timed out", or ran on a freed client when the callback had destroyed it,
as etcd_call_oneshot() does. Arm the timer only while the request is
still in flight.
2026-11-25 03:17:27 +03:00