You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
keep failed single-topic consumer mailboxes draining requests so calls made after shutdown complete instead of hanging
propagate multi-topic poller failures to the parent consumer and fail pending receives
drain failed multi-topic mailbox requests and close child consumers when DisposeAsync is called
add integration coverage for single-topic and multi-topic mailbox failures
Problem
When a consumer mailbox faulted, its reader stopped. Requests posted afterwards were accepted by the unbounded channel but never received a response. This could leave operations such as GetStats, ReceiveAsync, and DisposeAsync waiting indefinitely. A multi-topic poller failure was only logged, leaving the parent consumer apparently ready even though it could no longer deliver messages.
Implementation
After a mailbox exits, a lightweight drain continues reading its channel. Requests that can no longer be performed fail with AlreadyClosedException; close requests complete after the necessary local or child-consumer cleanup. Multi-topic poller failures are posted to the parent mailbox, which moves the consumer to a failed state and completes pending receives.
Verification
Unit tests: 216 passed, 2 skipped
Mailbox integration tests against Apache Pulsar 3.3.0: 3 passed
Mailbox failure drops messages without disposing payloads
src/Pulsar.Client/Internal/ConsumerImpl.fs:891
The catch-all also drops queued MessageReceived values without disposing their RawMessage.Payload. These payloads come from MemoryStreamManager, and every normal discard path explicitly disposes them (for example, ConsumerImpl.fs:1002-1052), so messages racing with a mailbox failure retain pooled buffers. Add a stopped-mailbox case that disposes the payload before discarding the message.
The reason will be displayed to describe this comment to others. Learn more.
Copilot review overview
🟡 Changes recommended
A partitioned producer request can still hang when that request triggers the mailbox failure, and the multi-topic test does not exercise waiter cleanup.
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
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
DisposeAsyncis calledProblem
When a consumer mailbox faulted, its reader stopped. Requests posted afterwards were accepted by the unbounded channel but never received a response. This could leave operations such as
GetStats,ReceiveAsync, andDisposeAsyncwaiting indefinitely. A multi-topic poller failure was only logged, leaving the parent consumer apparently ready even though it could no longer deliver messages.Implementation
After a mailbox exits, a lightweight drain continues reading its channel. Requests that can no longer be performed fail with
AlreadyClosedException; close requests complete after the necessary local or child-consumer cleanup. Multi-topic poller failures are posted to the parent mailbox, which moves the consumer to a failed state and completes pending receives.Verification