Skip to content

response-future: complete internal handoffs rejected during shutdown #1044

Description

@dkropachev

Problem

Several ResponseFuture continuations hand work to Session.submit(). During shutdown, submission can return None or raise after executor teardown, leaving the owning future pending indefinitely when timeout=None.

# Known limitation: this retry goes around the RetryPolicy and
# _query_retries, because both are keyed to the user's statement
# and this is the driver's own USE. It also has no backoff, so a
# flapping control connection re-sends USE until the client-side
# timeout fires instead of failing fast. Routing it through the
# retry machinery shared with the pooled path would be the fix.
self.session.submit(self._retry_task, False, host)

def _reprepare(self, prepare_message, host, connection, pool):
cb = partial(self.session.submit, self._execute_after_prepare, host, connection, pool)
if pool is None and connection is not None and connection.is_control_connection:

The fallback USE, reprepare, schema-refresh, and prepared-query paths share this handoff pattern. This was found while narrowing #392.

Expected behavior

A rejected internal handoff completes its ResponseFuture exactly once with an existing shutdown exception. Internal work must not be counted as a retry-policy decision.

Acceptance criteria

  • Shutdown or executor rejection cannot strand these internal continuations.
  • Completion remains single-shot when a response races rejection.
  • Unit tests cover the affected handoffs with timeout=None.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions