Skip to content

Conversation

@cunla
Copy link
Contributor

@cunla cunla commented Jan 27, 2026

fix #496

Copilot AI review requested due to automatic review settings January 27, 2026 14:30
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR attempts to fix a race condition in the DbTrackingModule where concurrent tracking events for the same message ID can cause duplicate key violations in the database. The fix wraps the persist method's logic in a synchronized(msg) block to provide mutual exclusion.

Changes:

  • Added synchronized block around the database persistence logic in DbTrackingModule.persist() method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

@uhurusurfa uhurusurfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be much simpler to just synchronize the entire method by adding synchronize to the method signature.
Although this blocks all threads even if they are trying to log a different message ID, this is a short term solution until the next major release and the performance cost is the same as the mechanism you have used which uses the concurrent hashmap since it will block all threads as well but adds the cost of managing a concurrent hashmap.

@cunla cunla requested a review from uhurusurfa January 27, 2026 16:27
Copy link
Contributor

@uhurusurfa uhurusurfa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🚀 Thanks for the fix

@uhurusurfa uhurusurfa merged commit ffc26f9 into OpenAS2:master Jan 27, 2026
11 checks passed
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.

Race condition in DbTrackingModule

2 participants