fix: ensure client keepalive < server keepalive to avoid client keepalive desync errors#1555
Open
ananthsub wants to merge 1 commit into
Open
Conversation
cmunley1
previously approved these changes
Jun 10, 2026
b7a8b6e to
b04120b
Compare
b04120b to
2235ecc
Compare
…nectedError uvicorn closes idle keep-alive connections after 5s by default while the aiohttp client keeps them pooled for 15s, causing ServerDisconnectedError when the client reuses a socket the server already closed. Set the client TCPConnector keepalive_timeout to 15s and the uvicorn timeout_keep_alive to 30s so pooled sockets are guaranteed live when reused. Signed-off-by: Ananth Subramaniam <ansubramania@nvidia.com>
2235ecc to
46c9356
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
uvicorn closes idle keep-alive connections after 5s by default (ref)
while the aiohttp client keeps them pooled for 15s by default (ref), causing ServerDisconnectedError when the client reuses a socket the server already closed.
This PR set the client TCPConnector
keepalive_timeoutto 15s and the uvicorntimeout_keep_aliveto 30s so pooled sockets are guaranteed live when reused.