babumahesh opened a new pull request, #10665:
URL: https://github.com/apache/gravitino/pull/10665
## What changes were proposed in this pull request?
Modified `AccessControlEventDispatcher` to use `dispatchEventSafe()` when
dispatching failure events instead of `dispatchEvent()`. This ensures that if a
listener throws an exception while handling a failure event, it
is caught and logged without propagating, `EventBus.dispatchEventSafe()`
is a wrapper on `dispatchEvent()` with exception handling, eliminating code
duplication.
## Why are the changes needed?
When `dispatcher.removeGroup()` (or any other access control operation)
throws an exception, the code enters a catch block and dispatches a
`FailureEvent`. If `eventBus.dispatchEvent(FailureEvent)` also throws because
a registered listener fails while handling that failure event, the
listener exception replaces the original exception. This hides the real root
cause from callers and makes production failures harder to diagnose.
By using `dispatchEventSafe()` for failure events, listener exceptions are
caught and logged without masking the original exception that triggered the
failure.
Fixes: #10658
## How was this patch tested?
- Added `testRemoveGroupFailureEventDoesNotMaskOriginalException()` in
`TestGroupEvent` to verify group operations
and the
original exception is propagated (not masked by listener exceptions)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]