Skip to content

response-future: release request ids after send failure#872

Open
dkropachev wants to merge 2 commits into
scylladb:masterfrom
dkropachev:dk/response-future-send-failure-cleanup
Open

response-future: release request ids after send failure#872
dkropachev wants to merge 2 commits into
scylladb:masterfrom
dkropachev:dk/response-future-send-failure-cleanup

Conversation

@dkropachev
Copy link
Copy Markdown
Collaborator

Fixes #871. Reclaims the request id when the send path fails after registration, and keeps the cleanup covered by unit tests.

@dkropachev dkropachev force-pushed the dk/response-future-send-failure-cleanup branch from 1e9287e to 7a92d92 Compare May 7, 2026 06:58
@dkropachev dkropachev self-assigned this May 7, 2026
@dkropachev dkropachev marked this pull request as ready for review May 7, 2026 10:15
@dkropachev dkropachev marked this pull request as draft May 7, 2026 10:47
@dkropachev dkropachev marked this pull request as ready for review May 8, 2026 02:58
@sylwiaszunejko sylwiaszunejko requested a review from Copilot May 11, 2026 06:41
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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_id in _query() and ensure it is released back to connection.request_ids on 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

response-future: release request ids after send failure

2 participants