Skip to content

DB Mutex of Memory outbox blocks Saga  #391

@janiskemper

Description

@janiskemper

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions