response-future: release request ids after send failure#872
Open
dkropachev wants to merge 2 commits into
Open
Conversation
1e9287e to
7a92d92
Compare
There was a problem hiding this comment.
Pull request overview
This PR fixes a request/stream ID leak in ResponseFuture._query() when the send path fails after a request ID has already been allocated, ensuring the ID is reclaimed and the connection state is cleaned up. This aligns with issue #871 by making request-id cleanup explicit for the “allocated-but-not-successfully-sent” failure path and keeping it covered by a unit test.
Changes:
- Track
request_idin_query()and ensure it is released back toconnection.request_idson send/encode failures after allocation. - Remove any partially-registered request callback state (
connection._requests) associated with the failed send before returning the connection to the pool. - Add a unit test to assert request-id reclamation and request map cleanup when a send fails after registration.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
cassandra/cluster.py |
Adds request-id aware cleanup on _query() exception paths to prevent stream/request ID leaks. |
tests/unit/test_response_future.py |
Adds regression coverage ensuring request IDs and _requests entries are cleaned up after post-allocation send failures. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
Fixes #871. Reclaims the request id when the send path fails after registration, and keeps the cleanup covered by unit tests.