Fix poison pill bug: Make retry heap unbounded#2012
Closed
the-mann wants to merge 2 commits intosender-block-on-failurefrom
Closed
Fix poison pill bug: Make retry heap unbounded#2012the-mann wants to merge 2 commits intosender-block-on-failurefrom
the-mann wants to merge 2 commits intosender-block-on-failurefrom
Conversation
- TestPoisonPillScenario: Validates continuous batch generation with 10 denied + 1 allowed log group - TestSingleDeniedLogGroup: Baseline test with 1 denied + 1 allowed log group - TestRetryHeapSmallerThanFailingLogGroups: Demonstrates deadlock when heap size < failing log groups (SKIPPED) The third test intentionally deadlocks to prove the bug exists when: - Retry heap size = concurrency (2) - Number of failing log groups (10) > heap size (2) - Workers block trying to push to full heap - System deadlocks, starving allowed log group
Remove max size constraint from retry heap to prevent deadlock when failing log groups exceed concurrency limit. Changes: - Remove maxSize and semaphore from retryHeap struct - Make Push() non-blocking (no semaphore wait) - Remove semaphore release from PopReady() - Update NewRetryHeap() to ignore maxSize parameter (kept for API compatibility) - Update TestRetryHeap_SemaphoreBlockingAndUnblocking -> TestRetryHeap_UnboundedPush - Update TestRetryHeapSmallerThanFailingLogGroups to validate fix Before: With concurrency=2 and 10 failing log groups, retry heap (size=2) would fill up, causing workers to block on Push(), leading to deadlock. After: Retry heap is unbounded, allowing all failed batches to be queued without blocking workers. Allowed log groups continue publishing normally. Test results: - TestRetryHeapSmallerThanFailingLogGroups: PASS (5/5 allowed batches published) - Heap grew to size 28 (beyond concurrency limit of 2) - No deadlock or starvation
This was referenced Feb 11, 2026
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.
Summary
Fix deadlock when failing log groups exceed concurrency limit by making the retry heap unbounded.
Problem
With bounded retry heap (size = concurrency):
Solution
Make retry heap unbounded:
Changes
maxSizeandsemaphorefrom retryHeap structPush()non-blocking (no semaphore wait)PopReady()NewRetryHeap()to ignore maxSize parameter (kept for API compatibility)TestRetryHeap_SemaphoreBlockingAndUnblocking→TestRetryHeap_UnboundedPushTestRetryHeapSmallerThanFailingLogGroupsto validate fixTest Results
Before Fix: Test deadlocked after 30s with all goroutines blocked
After Fix: ✅ Test PASSES
Related