fix(orca): make orca's redis queue handling more robust - #8002
Open
apoorvmahajandd wants to merge 4 commits into
Open
fix(orca): make orca's redis queue handling more robust#8002apoorvmahajandd wants to merge 4 commits into
apoorvmahajandd wants to merge 4 commits into
Conversation
* add retry for redis * fix * add exponential backoff * Refactor * refactor * handle silent drops * add comment explaining why * add same logic in other handlers
apoorvmahajandd
marked this pull request as ready for review
September 12, 2026 01:21
| abstract fun cacheScript() | ||
| abstract var readMessageWithLockScriptSha: String | ||
|
|
||
| protected fun <T> retry(block: () -> T): T { |
Member
There was a problem hiding this comment.
ONLY wondering if we shouldn't be using resillience4j kinda thing for this...this would work, just wondering about using standard libraries
jasonmcintosh
approved these changes
Sep 12, 2026
jasonmcintosh
left a comment
Member
There was a problem hiding this comment.
Overall good with this MINUS a "should we be using resillience4j" - which could be a different PR to refactor retries instead and we move with this for now.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Motivation
We saw multiple stuck/zombie executions with these stacktraces:
The stacktrace showed:
Changes
Layer 1: Redis Queue Retry with Exponential Backoff
Problem: RedisQueue.push() had no retry logic. A single transient JedisConnectionException during queue.push() would immediately propagate up, potentially leaving pipelines stuck.
New files:
Modified files:
Layer 2: JedisExceptionHandler Safety Net
Problem: When all queue-level retries are exhausted, the JedisConnectionException reaches the handler's catch blocks. Without an ExceptionHandler that recognizes Jedis exceptions as retryable, StartStageHandler would permanently fail the stage.
New files:
shouldRetry=true.
Modified files:
Layer 3: Handler Status Reset + Rethrow
Problem: When a handler persists a status change (e.g., RUNNING → SUCCEEDED) then fails on a subsequent queue.push(), keiko's ack-timeout retries the message. But the handler's status guard (e.g., stage.status in setOf(RUNNING, NOT_STARTED)) blocks the retried message because the status was already changed. Pipeline is permanently stuck.
Fix pattern: Save originalStatus before mutating, wrap queue operations in try/catch, restore exact original status on failure, persist via SQL, rethrow so keiko's ack-timeout retries the message.
StartStageHandler.kt
retryable: existing path (mark beforeStagePlanningFailed, push CompleteStage).
SkipStageHandler.kt
CompleteStageHandler.kt
AbortStageHandler.kt
StartExecutionHandler.kt
StartStageHandler's guard drops them once the stage moves to RUNNING.)
Tests
Each handler's existing Spek test file got a new describe("handling transient Redis exceptions") block: