Skip to content

Conversation

@djatnieks
Copy link

What is the issue

#15843: Fix access to thread-local data in Dispatcher and Message after migration from CompletableFuture to C* Future

What does this PR fix and why was it fixed

CNDB tests, like BillingTest.testBillingWithIsolatedTenant were failing with timeouts that are pretty generic from the driver:

java.lang.IllegalStateException: Trace 692c7d60-b41d-11f0-9dd7-897b41c7f3b5 still not complete after 10 attempts
	at com.datastax.oss.driver.internal.core.cql.QueryTraceFetcher.lambda$querySession$1(QueryTraceFetcher.java:95)
	at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:859)
	at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:837)
	at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:506)
	at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2079)
	at com.datastax.oss.driver.internal.core.cql.CqlRequestHandler.setFinalResult(CqlRequestHandler.java:324)
	at com.datastax.oss.driver.internal.core.cql.CqlRequestHandler.access$1500(CqlRequestHandler.java:95)
	at com.datastax.oss.driver.internal.core.cql.CqlRequestHandler$NodeResponseCallback.onResponse(CqlRequestHandler.java:655)
	at com.datastax.oss.driver.internal.core.channel.InFlightHandler.channelRead(InFlightHandler.java:257)

After debugging with ai agent help, it was discovered that the driver was timing out waiting for trace sessions in C* to complete, and the root cause that o.a.c.Future callbacks running on different threads did not have access to the correct ExecutorLocals state.

See the ticket for more details.

@github-actions
Copy link

Checklist before you submit for review

  • This PR adheres to the Definition of Done
  • Make sure there is a PR in the CNDB project updating the Converged Cassandra version
  • Use NoSpamLogger for log lines that may appear frequently in the logs
  • Verify test results on Butler
  • Test coverage for new/modified code is > 80%
  • Proper code formatting
  • Proper title for each commit staring with the project-issue number, like CNDB-1234
  • Each commit has a meaningful description
  • Each commit is not very long and contains related changes
  • Renames, moves and reformatting are in distinct commits
  • All new files should contain the DataStax copyright header instead of the Apache License one

…ExecutorLocals within Message.execute and Dispatcher.processInit. This ensures that Future callbacks, which may execute on different threads, can correctly access the expected thread-local state.
@sonarqubecloud
Copy link

sonarqubecloud bot commented Nov 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
71.4% Coverage on New Code (required ≥ 80%)

See analysis details on SonarQube Cloud

@cassci-bot
Copy link

❌ Build ds-cassandra-pr-gate/PR-2093 rejected by Butler


3 regressions found
See build details here


Found 3 new test failures

Test Explanation Runs Upstream
o.a.c.cql3.validation.operations.AggregationQueriesTest.testAggregationQueryShouldNotTimeoutWhenItExceedesReadTimeout (compression) REGRESSION 🔴🔴 2 / 14
o.a.c.distributed.test.NativeProtocolTest.withClientRequests REGRESSION 🔵🔴 0 / 14
o.a.c.index.sai.disk.v2.sortedterms.SortedTermsTest.testFileValidation (compression) REGRESSION 🔵🔴 0 / 14

Found 4 known test failures

@djatnieks djatnieks requested a review from driftx November 3, 2025 19:22
@djatnieks
Copy link
Author

A comparison of CNDB CI test results from a CNDB branch with these changes compared to the current main-5.0-b1c9b82251 branch results - about 30 fewer test failures.

https://butler-cndb.datastax.com/#/ci/upstream/compare/ci/cndb-15843/to/ci/main-5.0-b1c9b82251

Copy link

@driftx driftx left a comment

Choose a reason for hiding this comment

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

This makes sense since we are async but OSS doesn't need this because it's synchronous.

@djatnieks djatnieks merged commit c9bd53f into main-5.0 Nov 4, 2025
582 of 592 checks passed
@djatnieks djatnieks deleted the CNDB-15843 branch November 4, 2025 21:08
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.

4 participants