Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB Mutex of Memory outbox blocks Saga #391

Open
janiskemper opened this issue Sep 9, 2022 · 1 comment
Open

DB Mutex of Memory outbox blocks Saga #391

janiskemper opened this issue Sep 9, 2022 · 1 comment
Labels

Comments

@janiskemper
Copy link

Describe the bug
I use the memory outbox and wrote a saga that is an EventHandler called by the outbox. At the end of the saga, there is a new event created in the event store. This leads to the following situation:

  • Outbox wants to process the event A that is stored in the outbox. For this, the mutex blocks the outbox db. Outbox calls the saga as responsible event handler.
  • Saga does its job and creates a new event B that is stored in the event store.
  • As the outbox is connected to the event store, it has to handle the event as well. For this, the db mutex is locked again. However, it is already locked since the saga did not yet complete its job!
  • The result is that the saga can never handle the new event B as the db mutex is locked, it waits for it. At the same time, the outbox processor never unlocks the db because it never completed the event handling.

To Reproduce

  1. Use the memory outbox
  2. Build a saga that calls some command which in turn leads to an event saved in the store
  3. Call a command X that leads to the creation of event A. The saga should handle event A and call a command Y that leads to the creation of event B.

Expected behavior
The outbox should not block itself. I guess, that the db mutex could be safely removed from the memory outbox without anything serious happening.

Desktop (please complete the following information):

  • OS: Fedora 36
@maxekman
Copy link
Member

maxekman commented Oct 1, 2022

Thanks for reporting! If you can provide a PR with a fix I would be happy to merge it.

@maxekman maxekman added the bug label Oct 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

2 participants