spring-projects / spring-projects/spring-modulith
Identical events not handled properly, not sure if intentional
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 222
- PR merge metrics
- No merged PRs in 30d
Description
If I publish one event multiple times then
UPDATE EVENT_PUBLICATION
SET COMPLETION_DATE = ?
WHERE
LISTENER_ID = ?
AND SERIALIZED_EVENT = ?
Will update completion date on all of the records in the database: ones already completed and ones not even processed yet.
Should there be a unique constraint on listener_id and serialized_event or probably a better way to find the current record to update?
Actually stumbled upon this one by getting deadlocks when sending a lot of identical events and was wondering how a simple create then update once can deadlock :)
EDIT: I understand that modulith tries to guarantee at least once delivery so it doesn't break that but I still have that feeling that this could be handled in a more transparent way, would failing to process an identical event be considered bad?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the EVENT_PUBLICATION update statement and reproduce the deadlock with repeated identical events. Determine how the current record is selected without updating completed or unprocessed records, while preserving at-least-once delivery. Done means the behavior is defined and the update no longer affects unrelated publication records.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- backend, database
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100