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
Future cancellation doesn't seem to works when a client disconnect #3462
In Meilisearch we cannot process more search requests than we have core.
But we don't want to refuse search requests when all cores are used, which means we have to store a queue of search requests to process.
Sometimes users have searches that can take a few seconds to process.
When this happens, emptying the queue takes time. But it shouldn’t since most clients will disconnect after waiting for a few seconds.
When the queue gives us a permit to process a new search requests, I would like to check if a client is still connected before doing any extra work.
Your Environment
Rust Version (I.e, output of rustc -V): rustc 1.78.0 (9b00956e5 2024-04-29)
Actix Web Version: 4.9.0 and 4.8.0
Reacted by Oscar Bailey, Will Jones, max-lt, Tim Visée and Arnaud Gourlay
Reproduced with actix-web v4.15. Client disconnects (socket half-closures) are allowed by default, so a client FIN/EOF does not cancel the pending handler: the client could still be waiting for the response.
Setting HttpServer::h1_allow_half_closed(false) (available since v4.12) cancels the handler on EOF. This does disable support for clients that deliberately close their write side while waiting for a response, but there isn't a better way to handle this case.
Activity
Merge #4899
robjtede commentedon Oct 2, 2026
Stumbling across this in 2026...
Reproduced with actix-web v4.15. Client disconnects (socket half-closures) are allowed by default, so a client FIN/EOF does not cancel the pending handler: the client could still be waiting for the response.
Setting
HttpServer::h1_allow_half_closed(false)(available since v4.12) cancels the handler on EOF. This does disable support for clients that deliberately close their write side while waiting for a response, but there isn't a better way to handle this case.