Skip to content

fix: release pre-acquired stream ids - #965

Open
dkropachev wants to merge 1 commit into
scylladb:scylla-4.xfrom
dkropachev:dk/947-release-preacquired-stream-id
Open

fix: release pre-acquired stream ids#965
dkropachev wants to merge 1 commit into
scylladb:scylla-4.xfrom
dkropachev:dk/947-release-preacquired-stream-id

Conversation

@dkropachev

@dkropachev dkropachev commented Jul 20, 2026

Copy link
Copy Markdown

Summary

  • release pre-acquired stream-id reservations when request setup fails before the write is submitted to InFlightHandler
  • recover the default write coalescer when event-loop scheduling rejects a queued write
  • unwind continuous-request execution bookkeeping on pre-write setup failures
  • cover CQL, prepare, graph, continuous, admin reprepare, direct channel-handler requests, coalescer rejection, and closed pooled channels

Fixes #947.
Depends on #966 for latest Scylla IT compatibility.

Tests

  • JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 PATH=/usr/lib/jvm/java-17-openjdk-amd64/bin:$PATH mvn -pl core -Dtest=DefaultWriteCoalescerTest,ChannelHandlerRequestTest,DriverChannelTest,CqlRequestHandlerTest,DefaultSessionPoolsTest,CqlPrepareHandlerTest,GraphRequestHandlerTest,ContinuousCqlRequestHandlerTest,ContinuousGraphRequestHandlerSpeculativeExecutionTest,ReprepareOnUpTest,InFlightHandlerTest test

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

The change adds explicit cancellation for pre-acquired stream IDs when request preparation, throttling, channel selection, or write submission fails before in-flight handling. DriverChannel, RequestMessage, and InFlightHandler track reservation ownership. Request handlers guard setup and write paths. DefaultWriteCoalescer handles rejected scheduling and write failures. Tests cover these failure paths.

Sequence Diagram(s)

sequenceDiagram
  participant RequestHandler
  participant DriverChannel
  participant DefaultWriteCoalescer
  participant InFlightHandler
  RequestHandler->>DriverChannel: write request
  DriverChannel->>DefaultWriteCoalescer: enqueue request
  DefaultWriteCoalescer->>InFlightHandler: submit request
  DriverChannel-->>RequestHandler: failed future on write failure
  RequestHandler->>DriverChannel: cancelPreAcquireId() before submission
Loading

Possibly related PRs

Suggested labels: area/Driver_-_java-driver-4.x, P3

Suggested reviewers: copilot, nikagra

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 7.84% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the primary change: releasing pre-acquired stream IDs.
Description check ✅ Passed The description directly explains the stream-ID cleanup, coalescer recovery, bookkeeping changes, affected handlers, tests, and linked issue.
Linked Issues check ✅ Passed The changes address issue #947 by releasing pre-acquired IDs on early failures across the required request paths.
Out of Scope Changes check ✅ Passed The implementation and tests remain focused on stream-ID release, write-coalescer recovery, and continuous-request cleanup.

Comment @coderabbitai help to get the list of available commands.

@dkropachev
dkropachev force-pushed the dk/947-release-preacquired-stream-id branch 2 times, most recently from 3c4fed0 to 29080a7 Compare July 20, 2026 23:48
@dkropachev
dkropachev marked this pull request as draft July 27, 2026 13:11
@dkropachev
dkropachev requested a review from Copilot July 29, 2026 05:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Fixes #947 by releasing pre-acquired stream IDs when requests fail before reaching the in-flight pipeline.

Changes:

  • Adds explicit stream-ID reservation cancellation APIs.
  • Covers early failures across CQL, graph, continuous, admin, and channel-handler requests.
  • Adds regression tests for key failure paths.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
AdminRequestHandler.java Releases reservations on pre-write failures.
ThrottledAdminRequestHandler.java Handles throttling failures safely.
ChannelHandlerRequest.java Cancels failed direct-request reservations.
DriverChannel.java Handles rejected writes and exposes cancellation.
InFlightHandler.java Delegates reservation cancellation.
CqlRequestHandler.java Protects CQL request setup.
CqlPrepareHandler.java Protects prepare and reprepare setup.
DefaultSession.java Releases reservations from closed pooled channels.
GraphRequestHandler.java Protects graph request setup.
ContinuousRequestHandlerBase.java Protects continuous request setup and races.
PoolBehavior.java Adds cancellation verification support.
CqlRequestHandlerTest.java Tests decoration failure handling.
DriverChannelTest.java Tests rejected-write cancellation.
DefaultSessionPoolsTest.java Tests closed-channel handling.
ReprepareOnUpTest.java Tests throttled reprepare failures.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@dkropachev
dkropachev force-pushed the dk/947-release-preacquired-stream-id branch from 29080a7 to bff77b2 Compare July 29, 2026 05:24
Copilot AI review requested due to automatic review settings July 29, 2026 05:24

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 15 out of 15 changed files in this pull request and generated no new comments.

Comments suppressed due to low confidence (5)

core/src/main/java/com/datastax/oss/driver/internal/core/channel/DriverChannel.java:111

  • The new coalescer-exception path is not exercised by this test change: the added test only covers the earlier closing branch. Please add a test whose WriteCoalescer.writeAndFlush throws and verify both that the returned future fails with that cause and that the pre-acquired ID is cancelled; otherwise the core fallback for synchronous submission failures can regress unnoticed.
    try {
      return writeCoalescer.writeAndFlush(channel, message);
    } catch (Throwable t) {
      cancelPreAcquireId();
      return channel.newFailedFuture(t);

core/src/main/java/com/datastax/dse/driver/internal/core/graph/GraphRequestHandler.java:321

  • There is no test covering this new graph-specific cleanup path. Add a GraphRequestHandlerTest case that makes message or payload conversion throw after pool selection and verifies cancelPreAcquireId() and no write; the CQL test does not exercise these graph conversion steps.
        DriverExecutionProfile executionProfile =
            Conversions.resolveExecutionProfile(statement, context);
        GraphProtocol graphSubProtocol =
            GraphConversions.resolveGraphSubProtocol(statement, graphSupportChecker, context);
        Message message =

core/src/main/java/com/datastax/oss/driver/internal/core/cql/CqlPrepareHandler.java:246

  • This initial prepare cleanup has no regression test for a synchronous setup failure after channel acquisition. Add a CqlPrepareHandlerTest that makes toPrepareMessage or payload access throw and verifies the pre-acquired ID is cancelled without writing; this reservation-balancing behavior is independent from the CQL execution test.
      } finally {
        if (!writeSubmitted) {
          channel.cancelPreAcquireId();
        }

core/src/main/java/com/datastax/oss/driver/internal/core/channel/ChannelHandlerRequest.java:85

  • This direct channel-handler submission cleanup has no corresponding test. Please exercise a ChannelHandlerRequest whose request construction or raw writeAndFlush throws and verify the pre-acquired reservation is restored; these protocol-init/heartbeat paths bypass DriverChannel.write, so the DriverChannel test does not cover them.
      } finally {
        if (!writeSubmitted) {
          inFlightHandler.cancelPreAcquireId();
        }

core/src/main/java/com/datastax/dse/driver/internal/core/cql/continuous/ContinuousRequestHandlerBase.java:396

  • The continuous-request cleanup is untested, including removal of the callback that is added before request conversion. Add a ContinuousCqlRequestHandlerTest case where getMessage or createPayload fails and assert that the reservation is cancelled, no write occurs, and the callback is not left in inFlightCallbacks.
        if (!writeSubmitted) {
          if (nodeResponseCallback != null) {
            inFlightCallbacks.remove(nodeResponseCallback);
          }
          channel.cancelPreAcquireId();

@nikagra nikagra left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Overview

The reservation is made in ChannelSet.next() and consumed only in InFlightHandler.write(); anything that failed between those two points leaked a slot, so getAvailableIds() drifted downward and channels progressively looked saturated. This closes the gap on every early-exit path I can find — the five channel.write(...) call sites, DriverChannel.write() itself, DefaultSession.getChannel() on a closed pooled channel, and the caller-owned reservation in ThrottledAdminRequestHandler.

Verified locally

Built core at bff77b2 on JDK 11 — clean. Ran DriverChannelTest, CqlRequestHandlerTest, DefaultSessionPoolsTest, CqlPrepareHandlerTest, GraphRequestHandlerTest, ContinuousCqlRequestHandlerTest, ReprepareOnUpTest, InFlightHandlerTest, ChannelPoolTest127 tests, 0 failures. Surefire enables -ea by default, so StreamIdGenerator's assert available <= maxAvailableIds over-release guard was live for those runs.

I also traced every preAcquireId() producer (ChannelSet.next(), AdminRequestHandler.start(), ChannelHandlerRequest.send()) against every DriverChannel.write() caller and every new cancel site: the 1:1 pairing holds, I found no double-release. In particular ChannelPool.next(routingKey, shardSuggestion) only ever calls one ChannelSet.next() per invocation, and both shouldPreAcquireId=false handlers (ReprepareOnUp, CqlPrepareHandler.prepareOnOtherNode) really do sit on a pool-owned reservation.

What I liked

  • The writeSubmitted flag is the right idiom, not boilerplate to be simplified into catch (Throwable): setting it before addListener means a throw from addListener won't cancel a reservation the pipeline already owns. Worth keeping as-is.
  • The AtomicBoolean CAS in ThrottledAdminRequestHandler is genuinely load-bearing — ConcurrencyLimitingRequestThrottler.register() calls onThrottleReady() synchronously, so a throw there cancels once in onThrottleReady's catch and would cancel again in start()'s catch.
  • inFlightCallbacks.remove(nodeResponseCallback) in the continuous handler's finally — easy to miss, and a stale callback there would later get aborted spuriously.
  • (result, error)(preparedId, error) in CqlPrepareHandler de-shadows the result field. Nice drive-by.

Risk

Low: pure accounting, no protocol or wire change, no public API surface (all internal.*), one boolean store on the happy path. The failure mode of getting it wrong is over-release — getInFlight() going negative and a channel accepting more than max_requests_per_connection — and I couldn't construct such a path.

Verdict

Correct as written. The two things I'd want before merge are both documentation: the write() ownership contract and the now-stale preAcquireId() / StreamIdGenerator javadoc, since those comments are the only place the invariant holding all five finally blocks together is written down. Everything else is optional. I filed #980 for the sibling leak on these same paths.

Copilot AI review requested due to automatic review settings July 29, 2026 18:49
@dkropachev
dkropachev force-pushed the dk/947-release-preacquired-stream-id branch from bff77b2 to ef698f9 Compare July 29, 2026 18:49
@coderabbitai
coderabbitai Bot requested a review from nikagra July 29, 2026 18:51

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated no new comments.

@nikagra nikagra left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Verdict

Approving. All ten round-1 comments are addressed, including the three documentation items I named as my pre-merge conditions — those comments were the only place the invariant holding the five caller-side finally blocks together was written down, and they now say it.

Re-verified at ef698f9

I re-traced the accounting rather than re-reading the replies:

  • Producer/consumer pairing is still 1:1 with the six new cancel sites. ChannelPool.next() yields exactly one ChannelSet.next() on every branch (L178, L197, L204), so there's no double-acquire feeding a double-release.
  • write()'s no-throw contract now holds by construction, which is what makes the new Javadoc true rather than aspirational: the only throwing statements sit inside the new try, so writeSubmitted is always true once write() returns.
  • The catch in write() cannot over-release. With DefaultWriteCoalescer, InFlightHandler.write() runs from the flusher task on the event loop, never synchronously inside writeAndFlush. With PassThroughWriteCoalescer, Netty's invokeWrite0 converts handler exceptions into a failed promise instead of propagating. So nothing can throw after streamIds.acquire() consumed the id. The realistic throw is RejectedExecutionException from eventLoop.execute() — and there the queued Write is permanently stranded (running stays true), so the id really is unused and cancelling is correct.
  • holdsExternalReservation.set(false) before super.start() is load-bearing. Inverting those two lines would double-release, since AdminRequestHandler.start()'s own finally covers everything from that point on. Worth keeping in that order.
  • The new continuous test genuinely pins the new branch. verifyNoWrite() is what rules out the finally path at L396 — without it the test would pass either way.
  • Also checked: AdminRequestHandler schedules timeoutFuture only in onWriteComplete, so a request sitting in the throttler has no timer that could fire setFinalError behind the reservation, and throttler close() drains via onThrottleFailure, which cancels. And the should_complete_result_if_first_node_replies_immediately rewrite is a literal inlining of Builder.withResponse — no semantic change, it just exposes the handle.

On the one thing you declined

Keeping catch (Throwable) is fine. The reasoning refutes the exact snippet I suggested rather than the general shape — rethrowing without cancelling would also have worked — but the contract you chose instead is the better answer anyway: it's documented on the method, it holds by construction, and should_cancel_pre_acquired_id_when_coalesced_write_throws_error pins it. The reservation is released either way, which was my actual concern. No further action.

Non-blocking

Three notes inline. None needs to happen before merge — two are style/consistency, and one belongs to #980, where I've recorded it. Coverage is unchanged from round 1: the four finally paths Copilot flagged are still untested and, as I said then, I'm not blocking on those; the one branch I did ask for is covered.

CI is green across Build, Unit tests and Full verify on JDK 11 and 17 plus every Scylla and Cassandra IT matrix, and #966 landed on 2026-07-20, so the dependency note in the description is resolved.

Copilot AI review requested due to automatic review settings July 31, 2026 16:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 2 comments.

Copilot AI review requested due to automatic review settings August 1, 2026 09:35
@dkropachev
dkropachev force-pushed the dk/947-release-preacquired-stream-id branch from e5015ce to 624945b Compare August 1, 2026 09:35
@coderabbitai
coderabbitai Bot requested a review from nikagra August 1, 2026 09:36

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 23 out of 23 changed files in this pull request and generated 1 comment.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
core/src/test/java/com/datastax/oss/driver/internal/core/channel/DefaultWriteCoalescerTest.java (1)

100-101: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Rename this test to describe the enqueue retry path.

The name should_fail_concurrently_enqueued_writes_if_rescheduling_is_rejected is almost identical to should_fail_concurrently_enqueued_writes_when_rescheduling_is_rejected at Line 169, but the two tests cover different code paths. This test rejects the second eventLoop.execute() call inside Flusher.enqueue. The test at Line 169 rejects eventLoop.schedule() inside runOnEventLoop.

♻️ Suggested rename
   `@Test`
-  public void should_fail_concurrently_enqueued_writes_if_rescheduling_is_rejected() {
+  public void should_fail_concurrently_enqueued_writes_if_enqueue_retry_is_rejected() {
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@core/src/test/java/com/datastax/oss/driver/internal/core/channel/DefaultWriteCoalescerTest.java`
around lines 100 - 101, Rename the test method
should_fail_concurrently_enqueued_writes_if_rescheduling_is_rejected to
explicitly describe the enqueue retry path and rejection of the second
eventLoop.execute() call inside Flusher.enqueue, distinguishing it from the
separate runOnEventLoop scheduling test.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@core/src/test/java/com/datastax/oss/driver/internal/core/channel/DefaultWriteCoalescerTest.java`:
- Around line 100-101: Rename the test method
should_fail_concurrently_enqueued_writes_if_rescheduling_is_rejected to
explicitly describe the enqueue retry path and rejection of the second
eventLoop.execute() call inside Flusher.enqueue, distinguishing it from the
separate runOnEventLoop scheduling test.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: c935e787-0392-489a-8ce0-89f023a4b08a

📥 Commits

Reviewing files that changed from the base of the PR and between ef698f9 and 624945b.

📒 Files selected for processing (23)
  • core/src/main/java/com/datastax/dse/driver/internal/core/cql/continuous/ContinuousRequestHandlerBase.java
  • core/src/main/java/com/datastax/dse/driver/internal/core/graph/GraphRequestHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/adminrequest/AdminRequestHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/adminrequest/ThrottledAdminRequestHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/ChannelHandlerRequest.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/DefaultWriteCoalescer.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/DriverChannel.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/InFlightHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/StreamIdGenerator.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/cql/CqlPrepareHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/cql/CqlRequestHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/session/DefaultSession.java
  • core/src/test/java/com/datastax/dse/driver/internal/core/cql/continuous/ContinuousCqlRequestHandlerTest.java
  • core/src/test/java/com/datastax/dse/driver/internal/core/graph/ContinuousGraphRequestHandlerSpeculativeExecutionTest.java
  • core/src/test/java/com/datastax/dse/driver/internal/core/graph/GraphRequestHandlerTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/channel/ChannelHandlerRequestTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/channel/DefaultWriteCoalescerTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/channel/DriverChannelTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/cql/CqlPrepareHandlerTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/cql/CqlRequestHandlerTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/cql/PoolBehavior.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/session/DefaultSessionPoolsTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/session/ReprepareOnUpTest.java
🚧 Files skipped from review as they are similar to previous changes (12)
  • core/src/main/java/com/datastax/oss/driver/internal/core/adminrequest/AdminRequestHandler.java
  • core/src/main/java/com/datastax/dse/driver/internal/core/graph/GraphRequestHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/StreamIdGenerator.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/cql/PoolBehavior.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/adminrequest/ThrottledAdminRequestHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/cql/CqlRequestHandler.java
  • core/src/test/java/com/datastax/dse/driver/internal/core/graph/ContinuousGraphRequestHandlerSpeculativeExecutionTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/cql/CqlRequestHandlerTest.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/session/DefaultSession.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/session/ReprepareOnUpTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/session/DefaultSessionPoolsTest.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/cql/CqlPrepareHandler.java

Copilot AI review requested due to automatic review settings August 1, 2026 10:30
@dkropachev
dkropachev force-pushed the dk/947-release-preacquired-stream-id branch from 624945b to cb3c855 Compare August 1, 2026 10:30

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@core/src/test/java/com/datastax/oss/driver/internal/core/adminrequest/ThrottledAdminRequestHandlerTest.java`:
- Around line 100-110: Update newHandler and the cleanup tests to use a real
pre-acquired reservation: call and retain channel.preAcquireId() before
handler.start(), configure the mock stateful reservation behavior, and assert
cancelPreAcquireId() clears the reservation rather than only verifying
invocation. Add separate coverage for the shouldPreAcquireId=true path if
handler-owned acquisition is required.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f7e6b1a0-d9fc-47e8-b3e8-a2d40c54eb16

📥 Commits

Reviewing files that changed from the base of the PR and between 624945b and cb3c855.

📒 Files selected for processing (24)
  • core/src/main/java/com/datastax/dse/driver/internal/core/cql/continuous/ContinuousRequestHandlerBase.java
  • core/src/main/java/com/datastax/dse/driver/internal/core/graph/GraphRequestHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/adminrequest/AdminRequestHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/adminrequest/ThrottledAdminRequestHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/ChannelHandlerRequest.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/DefaultWriteCoalescer.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/DriverChannel.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/InFlightHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/StreamIdGenerator.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/cql/CqlPrepareHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/cql/CqlRequestHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/session/DefaultSession.java
  • core/src/test/java/com/datastax/dse/driver/internal/core/cql/continuous/ContinuousCqlRequestHandlerTest.java
  • core/src/test/java/com/datastax/dse/driver/internal/core/graph/ContinuousGraphRequestHandlerSpeculativeExecutionTest.java
  • core/src/test/java/com/datastax/dse/driver/internal/core/graph/GraphRequestHandlerTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/adminrequest/ThrottledAdminRequestHandlerTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/channel/ChannelHandlerRequestTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/channel/DefaultWriteCoalescerTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/channel/DriverChannelTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/cql/CqlPrepareHandlerTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/cql/CqlRequestHandlerTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/cql/PoolBehavior.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/session/DefaultSessionPoolsTest.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/session/ReprepareOnUpTest.java
🚧 Files skipped from review as they are similar to previous changes (22)
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/ChannelHandlerRequest.java
  • core/src/main/java/com/datastax/dse/driver/internal/core/graph/GraphRequestHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/StreamIdGenerator.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/session/DefaultSession.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/cql/PoolBehavior.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/adminrequest/AdminRequestHandler.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/session/DefaultSessionPoolsTest.java
  • core/src/test/java/com/datastax/dse/driver/internal/core/graph/GraphRequestHandlerTest.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/InFlightHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/cql/CqlPrepareHandler.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/cql/CqlRequestHandlerTest.java
  • core/src/main/java/com/datastax/dse/driver/internal/core/cql/continuous/ContinuousRequestHandlerBase.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/cql/CqlPrepareHandlerTest.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/adminrequest/ThrottledAdminRequestHandler.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/session/ReprepareOnUpTest.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/cql/CqlRequestHandler.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/channel/DefaultWriteCoalescerTest.java
  • core/src/test/java/com/datastax/dse/driver/internal/core/cql/continuous/ContinuousCqlRequestHandlerTest.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/DriverChannel.java
  • core/src/test/java/com/datastax/dse/driver/internal/core/graph/ContinuousGraphRequestHandlerSpeculativeExecutionTest.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/channel/DefaultWriteCoalescer.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/channel/DriverChannelTest.java

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated no new comments.

Release stream-id reservations when a channel has been pre-acquired but the request fails before it is submitted to InFlightHandler.

Clean up coalesced writes and continuous-request throttler permits when scheduling or request setup is rejected.

Cover CQL, prepare, graph, continuous, admin reprepare, direct channel-handler requests, and closed pooled channels.

Fixes scylladb#947.

Signed-off-by: Dmitry Kropachev <dmitry.kropachev@gmail.com>
Copilot AI review requested due to automatic review settings August 1, 2026 14:42
@dkropachev
dkropachev force-pushed the dk/947-release-preacquired-stream-id branch from cb3c855 to 74327df Compare August 1, 2026 14:42

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 24 out of 24 changed files in this pull request and generated no new comments.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4.x: Pre-acquired stream id can leak when request fails before InFlightHandler write

3 participants