Skip to content

Fix outbox clear isolation between mediators#4242

Open
thomhurst wants to merge 1 commit into
BrighterCommand:masterfrom
thomhurst:fix/outbox-mediator-instance-clear-lock
Open

Fix outbox clear isolation between mediators#4242
thomhurst wants to merge 1 commit into
BrighterCommand:masterfrom
thomhurst:fix/outbox-mediator-instance-clear-lock

Conversation

@thomhurst

@thomhurst thomhurst commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • scope the nonblocking background-clear semaphore to each OutboxProducerMediator instance
  • preserve suppression of overlapping clears on the same mediator
  • add a deterministic concurrent regression test using two independent mediators and outboxes

Root cause

The semaphore was static for each closed generic mediator type. A clear running on one mediator therefore caused another mediator with a different outbox to fail WaitAsync(TimeSpan.Zero) and silently skip its own clear.

Validation

  • regression test failed before the fix on net9.0 and net10.0 (Expected: 1, Actual: 0)
  • regression test passes after the fix on net9.0 and net10.0
  • Core command-processor clear suite: 4 passed, 2 existing skips per target framework
  • InMemory sweeper suite: 10 passed per target framework

Closes #4241

Independent mediators can own different outboxes and must not suppress each other's nonblocking clear operation.

Closes BrighterCommand#4241
@thomhurst

Copy link
Copy Markdown
Contributor Author

@iancooper Happy for me to merge?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

OutboxProducerMediator can skip clears across independent instances

2 participants