Skip to content

fix(reliability): bound CassandraUtil read retries to stop StackOverflow crash (CJ-1) - #909

Open
pallakartheekreddy wants to merge 1 commit into
v1.0.3from
security/cassandrautil-bounded-retry
Open

fix(reliability): bound CassandraUtil read retries to stop StackOverflow crash (CJ-1)#909
pallakartheekreddy wants to merge 1 commit into
v1.0.3from
security/cassandrautil-bounded-retry

Conversation

@pallakartheekreddy

Copy link
Copy Markdown
Collaborator

Summary

Fixes CJ-1 (P0, foundational) in implementation-designs/knowledge-platform-jobs.md.

The bug

jobs-core CassandraUtil.findOne/find caught DriverException, called reconnect(), then recursed into themselves with no attempt cap:

catch { case ex: DriverException => this.reconnect(); this.findOne(query) }

A persistently failing read (bad CQL, node down, query timeout) recurses until StackOverflowError, crashing the Flink task for all tenants — the "one poison event kills the pipeline" failure mode this repo is prone to.

The fix

Replaced the unbounded self-recursion with a bounded reconnect-and-retry helper (maxQueryRetries = 3) that rethrows the DriverException after exhaustion, so the caller can dead-letter / let Flink restart instead of stack-overflowing. Reconnect-on-error behaviour is preserved.

Verification

  • jobs-core test-compiles under JDK 11 (-Pazure, exit 0; CassandraUtil recompiled).

⚠️ Mirror required

jobs-core is a duplicated fork shared with data-pipeline/jobs-core, which has the same bug (finding D14.1). The identical fix should be applied there in a separate PR.

Note: two pre-existing tracked deletions under kubernets/pipelines/build/ are unrelated and excluded from this branch.

…low crash (CJ-1)

jobs-core CassandraUtil.findOne/find caught DriverException, called reconnect(),
then recursed into themselves with no attempt cap. A persistently failing read
(bad CQL, node down, query timeout) recursed until StackOverflowError, crashing the
Flink task for all tenants -- the "one poison event kills the pipeline" failure mode.

Replace the unbounded self-recursion with a bounded reconnect-and-retry helper
(max 3 attempts) that rethrows the DriverException after exhaustion, so the caller
can dead-letter / let Flink restart instead of stack-overflowing.

Verified: jobs-core test-compiles under JDK 11 (azure profile).

Implements CJ-1 (P0) from implementation-designs/knowledge-platform-jobs.md.
NOTE: jobs-core is duplicated in data-pipeline/jobs-core (same bug, finding D14.1);
the identical fix should be mirrored there in a separate PR.
@coderabbitai

coderabbitai Bot commented Jul 22, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@pallakartheekreddy, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 28 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: b6d4d080-2359-47b6-ab25-bf17a1c66773

📥 Commits

Reviewing files that changed from the base of the PR and between 876b824 and e6832a2.

📒 Files selected for processing (15)
  • .claude/commands/build.md
  • .claude/commands/commit.md
  • .claude/commands/coverage.md
  • .claude/commands/pr.md
  • .claude/commands/test.md
  • .claude/rules/code-documentation.md
  • .claude/rules/configuration-discipline.md
  • .claude/rules/error-handling.md
  • .claude/rules/flink-build.md
  • .claude/rules/job-conventions.md
  • .claude/rules/jobs-core.md
  • .claude/rules/logging-observability.md
  • .claude/rules/testing-requirements.md
  • CLAUDE.md
  • jobs-core/src/main/scala/org/sunbird/job/util/CassandraUtil.scala
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch security/cassandrautil-bounded-retry

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.

@pallakartheekreddy
pallakartheekreddy changed the base branch from master to v1.0.3 July 27, 2026 09:49
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.

1 participant