Issue 5337: Handle closed event loops #5410
Open
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:
The issue that this attempts to correct is #5337
There is a race condition in case someone attempts to send a message on the eventbus to an address at the same time as the receiver is being undeployed - if the receiver's context has it's own worker pool, that worker pool will get shutdown, and it won't be possible to enqueue the operation to receive the message, and exception will be thrown. This affects both send and publish - in the latter case, an undefined number of registered consumers will receive the message in case this race condition affects one of the receivers.
I've written unit tests for both local and clustered eventbus, and I think that the code coverage for them are quite comprehensive.
Conformance: