fix: add panic recovery in distributor event pipeline#7
Merged
Neo23x0 merged 1 commit intoNextron-Labs:masterfrom Mar 14, 2026
Merged
Conversation
A panicking consumer (e.g. due to a nil pointer in a Sigma rule evaluation or IOC regex engine) would crash the entire event loop, killing Aurora. This wraps each consumer's HandleEvent in a deferred recover so that: 1. The panic is caught and logged as an error 2. Remaining consumers still receive the event 3. The distributor continues processing subsequent events Added TestDistributorPanicRecovery: registers a deliberately panicking consumer before a counting consumer, sends an event, and verifies the counter still increments.
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.
Problem
A panicking consumer crashes the entire event loop. If a Sigma rule evaluation, IOC regex match, or any consumer's
HandleEventhits a nil pointer or other panic, Aurora dies — no more events processed, no graceful recovery.This is the kind of bug you don't find with happy-path tests. It requires adversarial testing with a deliberately broken consumer.
Fix
Wrapped each consumer's
HandleEventcall insafeHandleEvent()withdefer recover():Test
TestDistributorPanicRecovery: registers a panicking consumer before a counting consumer, sends an event through the replay provider, and verifies:d.Processed()increments (distributor kept running)All tests pass