You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cshutdn: EXPIRE_SHUTDOWN never armed in event-driven mode, connections to silent servers linger #23551
In curl_multi_socket_action mode, a connection whose peer goes silent during shutdown (no TLS close-notify, TCP kept open) is never closed by the 2-second shutdown timeout. It lingers until the application itself drives the multi again or cleans up.
What happens:
The only code that arms EXPIRE_SHUTDOWN on the admin handle is cshutdn_perform(), and cshutdn_perform() runs only when the multi processes the admin handle. When a connection enters shutdown, Curl_cshutdn_start_timer() deliberately skips arming for the admin (the if(data->mid) guard), and Curl_cshutdn_add() neither arms a timer nor marks the admin dirty. A silent peer produces no socket I/O. So nothing ever wakes the admin, and the code that would arm the wakeup timer only runs after the wakeup has already happened.
Run on current master 5d4eaac8f (2026-10-18), 10 sequential HTTPS transfers to a server that answers each request normally but sends no close-notify:
10x start_timer (mid=0, timeout 2000) and 10x add during the transfers
15 seconds idle: FD count frozen at 16, zero shutdown-range timer callbacks,
cshutdn_perform invoked 0 times
next multi call: cshutdn_perform runs once, all 10 connections terminated
immediately (done=1 each)
The cleanup itself works. Nothing schedules it. For contrast, curl 7.81.0 (the pre-cshutdn implementation) arms 5 shutdown-range timers on the same harness and closes all such connections. curl_multi_perform is unaffected because the admin handle is processed on every call.
How to reproduce:
Event-driven harness using curl_multi_socket_action with CURLMOPT_SOCKETFUNCTION and CURLMOPT_TIMERFUNCTION, CURLOPT_FORBID_REUSE set.
HTTPS transfers against a Python TLS server that completes each exchange but sends no close-notify and keeps the connections open.
Watch the FD count and timer callback values during a 15-second idle window after the transfers.
Suggested fix:
Arm EXPIRE_SHUTDOWN on the admin handle in Curl_cshutdn_add(), or mark the admin dirty there, so cshutdn_perform() gets its first run and the existing accumulator arms the timer.
Activity
icing commentedon Oct 22, 2026
Thanks for the report and the nice analysis. Could you verify that #23557 fixes the issue also for you?
cshutdown: fix event handling
Nora-Qiu commentedon Oct 23, 2026
Verified. All 10 connections now close right after the transfers, FD count back at baseline within seconds. Thanks.