Skip to content

Fix synchronous throttled request failures#963

Open
arnabnandy7 wants to merge 1 commit into
scylladb:scylla-4.xfrom
arnabnandy7:fix/on-throttle-ready-errors
Open

Fix synchronous throttled request failures#963
arnabnandy7 wants to merge 1 commit into
scylladb:scylla-4.xfrom
arnabnandy7:fix/on-throttle-ready-errors

Conversation

@arnabnandy7

Copy link
Copy Markdown

Summary

Add top-level error handling around onThrottleReady() request setup for:

  • CQL requests
  • prepare requests
  • graph requests
  • continuous paging requests

Fixes #949.

Root cause

Request throttlers invoke onThrottleReady() directly. Query-plan creation, execution-profile
resolution, metric updates, or request scheduling can throw synchronously from this callback.

Those exceptions previously bypassed the request handlers' normal terminal-error paths. On the
immediate throttler path, this could make executeAsync() throw instead of returning a failed
future. On a queued path, the exception could escape on the throttler or event-loop thread and
leave the request future incomplete.

Solution

Wrap each request handler's onThrottleReady() setup in a catch-all error boundary and route
failures through its existing terminal-error flow.

This ensures that synchronous setup failures:

  • complete the user-facing future exceptionally;
  • release or notify the request throttler correctly;
  • behave consistently for immediate and delayed requests.

A regression test verifies that a synchronous query-plan creation failure is returned through a
failed completion stage instead of escaping request construction.

Testing

  • CqlRequestHandlerTest: 7 tests passed
  • CqlPrepareHandlerTest: 9 tests passed
  • GraphRequestHandlerTest: 30 tests passed
  • ContinuousGraphRequestHandlerTest: 5 tests passed
  • Maven formatting and XML checks passed
  • git diff --check passed

Signed-off-by: Arnab Nandy <arnab_nandy7@yahoo.com>
@coderabbitai

coderabbitai Bot commented Jul 19, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b1590bb0-8eda-4ef0-9087-861ba6e17968

📥 Commits

Reviewing files that changed from the base of the PR and between 3cafb2a and 4c67775.

📒 Files selected for processing (5)
  • 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/cql/CqlPrepareHandler.java
  • core/src/main/java/com/datastax/oss/driver/internal/core/cql/CqlRequestHandler.java
  • core/src/test/java/com/datastax/oss/driver/internal/core/cql/CqlRequestHandlerTest.java

📝 Walkthrough

Walkthrough

The request handlers for CQL, prepare, graph, and continuous CQL now catch exceptions thrown during throttled request setup, including execution-profile resolution, query-plan construction, metrics updates, and initial dispatch. Failures are routed through existing final-error or abort paths, and continuous requests also signal the throttler. A CQL test verifies that a query-plan creation exception completes the returned future exceptionally with the same exception.

Suggested reviewers: nikagra

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title matches the main change: adding synchronous error handling for throttled request setup.
Description check ✅ Passed The description is on-topic and accurately describes the throttled request error-handling fix.
Linked Issues check ✅ Passed The changes address #949 by wrapping onThrottleReady setup in error boundaries across CQL, prepare, graph, and continuous handlers.
Out of Scope Changes check ✅ Passed The changed files and added test all support the throttled request failure fix, with no clear unrelated additions.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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.x: onThrottleReady exceptions can escape or leave request futures incomplete

1 participant