Add timeout-aware getUninterruptibly and verify 4.x future completion paths #775
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.
Issue #365 reported that 3.x driver could hang indefinitely when
DefaultResultSetFuturewasn't properly completed. Analysis shows 4.x architecture already prevents this through REQUEST_TIMEOUT mechanism and correct future completion in all code paths.Changes
Added timeout-aware blocking utility
CompletableFutures.getUninterruptibly(CompletionStage<T>, Duration)methodVerified existing protections
setFinalResult()orsetFinalError()FUTURE_COMPLETION_ANALYSIS.mdNotes
Sync processors unchanged - async layer timeout is sufficient. The new method provides explicit timeout control for advanced use cases where applications need stricter guarantees than REQUEST_TIMEOUT configuration.
Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
66.55.32.54.in-addr.arpa/usr/lib/jvm/temurin-8-jdk-amd64/bin/java /usr/lib/jvm/temurin-8-jdk-amd64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/jacoco/org.jacoco.agent/0.8.13/org.jacoco.agent-0.8.13-runtime.jar=destfile=/home/REDACTED/work/java-driver/java-driver/core/target/jacoco.exec -jar /home/REDACTED/work/java-driver/java-driver/core/target/surefire/surefirebooter-20251228134921200_3.jar /home/REDACTED/work/java-driver/java-driver/core/target/surefire 2025-12-28T13-49-21_129-jvmRun1 surefire-20251228134921200_1tmp surefire_0-20251228134921200_2tmp ure tContinuousAsync--norc /snap/bin/grep grep -l d -n 10 /src/main/java/com/datastax/oss/driver/api/mapper/annotations/DaoKeyspace.java nfig/composer/vendor/bin/grep ure a ndor/bin/grep grep(dns block)myaddress/usr/lib/jvm/temurin-8-jdk-amd64/bin/java /usr/lib/jvm/temurin-8-jdk-amd64/bin/java -javaagent:/home/REDACTED/.m2/repository/org/jacoco/org.jacoco.agent/0.8.13/org.jacoco.agent-0.8.13-runtime.jar=destfile=/home/REDACTED/work/java-driver/java-driver/core/target/jacoco.exec -jar /home/REDACTED/work/java-driver/java-driver/core/target/surefire/surefirebooter-20251228134921200_3.jar /home/REDACTED/work/java-driver/java-driver/core/target/surefire 2025-12-28T13-49-21_129-jvmRun1 surefire-20251228134921200_1tmp surefire_0-20251228134921200_2tmp ure tContinuousAsync--norc /snap/bin/grep grep -l d -n 10 /src/main/java/com/datastax/oss/driver/api/mapper/annotations/DaoKeyspace.java nfig/composer/vendor/bin/grep ure a ndor/bin/grep grep(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
This section details on the original issue you should resolve
<issue_title>3.x: there is some case when driver does not release
DefaultResultSetFutureproperly</issue_title><issue_description>It comes from scylladb/cassandra-stress#30.
Time to time it can stuck waiting for
DefaultResultSetFutureto be released:It means that there is a bug in
ReleaseHandleror inDefaultResultSetFuturethat leavesDefaultResultSetFuturewithoutsetorsetExceptioncalled on it.As result
getUninterruptiblywaits for it forever.to go forward we need to do the following:
ReleaseHandlerandDefaultResultSetFutureto make sure every case ends up insetorsetExceptionAbstractSession.execute(Statement statement)to have timeout ongetUninterruptibly.</issue_description>Comments on the Issue (you are @copilot in this section)
@roydahan @dkropachev why is it still in "NEW"? Shall we queue it and prioritize it for work? I saw it affects at least 1-2 CI stability issues. @dkropachev > [@dkropachev](https://github.com/dkropachev) why is it still in "NEW"? Shall we queue it and prioritize it for work? I saw it affects at least 1-2 CI stability issues.There was lots of work done to pin point the issue, unfortunately it was pushed out by other higher priority tasks.
@dkropachev I will prioritize it this week. @roydahan @dkropachev & @nikagra I think it's time to fix this set of issues with java 3.x and get rid of these ci-stability issues. @nikagra @dkropachev > Check `ReleaseHandler` and `DefaultResultSetFuture` to make sure every case ends up in `set` or `setException`I have scheduled it for next sprint.</comment_new>
<comment_new>@roydahan
@dkropachev , @Bouncheck,
This issue translates into CI stability issues (Through scylladb/cassandra-stress#30) and IIUC correctly a customer issue.
Hence, this issue should have higher (highest?) priority this week/next week.
Checking
DefaultResultSetFuture.onSetmethod:RESULTSET_KEYSPACE(direct call toset)SCHEMA_CHANGE!cluster.configuration.getQueryOptions().isMetadataEnabled()(indirectly viacluster.waitForSchemaAgreementAndSignal)CREATEDorUPDATED(indirectly viacluster.refreshSchemaAndSignal)DROPPEDcase (indirectly viasession.cluster.manager.waitForSchemaAgreementAndSignaldefaultcase does not set any result or exceptiondefaultcase (direct call toset)ERROR(direct call tosetException)default(direct call tosetException)setException)So, unknown schema change may result in no result set in the future.
DefaultResultSetFuturealready have an overloaded version ofgetUninterruptiblyhandling timeouts: