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

Use ConcurrentHashMap in Stamp.scala #1317

Merged
merged 1 commit into from
Dec 28, 2023

Conversation

Friendseeker
Copy link
Member

@Friendseeker Friendseeker commented Dec 28, 2023

Issue

The two synchronized locks in Stamp.scala sometimes take too long to be grabbed (#1129)

Mitigation

Not sure about the root cause of the issue. But we can at least make lock more granular via using ConcurrentHashMap instead of synchronized.

As bonus this change addresses a potential race condition. When InitialStamps.source and InitialStamps.getAllSourceStamps is called concurrently, the access is not thread-safe. Such access pattern is probably very rare / never happens in practice, but nonetheless an improvement that it is addressed.

@Friendseeker Friendseeker marked this pull request as ready for review December 28, 2023 04:32
Copy link
Member

@eed3si9n eed3si9n left a comment

Choose a reason for hiding this comment

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

Thanks!

@eed3si9n eed3si9n merged commit 0034a23 into sbt:develop Dec 28, 2023
7 checks passed
@Friendseeker Friendseeker deleted the fine-grain-stamp-locking branch December 28, 2023 20:04
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.

2 participants