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

Race condition in KeyLocker #170

Open
Yrlec opened this issue May 27, 2020 · 1 comment
Open

Race condition in KeyLocker #170

Yrlec opened this issue May 27, 2020 · 1 comment

Comments

@Yrlec
Copy link

Yrlec commented May 27, 2020

Thank you for creating this great library!

I found a potential race condition on this line in KeyLocker:

if (!semaphoreMap.containsKey(key)) {

One should use putIfAbsent instead. See https://stackoverflow.com/a/15850870/71354 for an explanation.

@pilgr
Copy link
Owner

pilgr commented May 27, 2020

@Yrlec Good catch, thanks!

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

No branches or pull requests

2 participants