-
Notifications
You must be signed in to change notification settings - Fork 363
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 acquireLock #81
Comments
nicktindall
added a commit
that referenced
this issue
Oct 20, 2021
nicktindall
added a commit
that referenced
this issue
Oct 20, 2021
nicktindall
added a commit
that referenced
this issue
Oct 20, 2021
nicktindall
added a commit
that referenced
this issue
Oct 20, 2021
nicktindall
added a commit
that referenced
this issue
Oct 21, 2021
Released in Java-Thread-Affinity-3.21ea81, BOM-2.22ea49 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When multiple processes are attempting to acquire the same lock, the check to see if the core can be reserved (
canReserve
) and the subsequent locking of the core (updateLockForCurrentThread
) are done as two separate steps.Java-Thread-Affinity/affinity/src/main/java/net/openhft/affinity/LockInventory.java
Lines 109 to 112 in ac876e3
The locking of the core logs and swallows exceptions thrown in the process of locking, meaning if two threads pass the
canReserve
check, while it's reservable they will both go on to "lock" the core:Java-Thread-Affinity/affinity/src/main/java/net/openhft/affinity/LockCheck.java
Lines 112 to 121 in ac876e3
Meaning you end up with multiple threads locked to a single core. The check and lock should be atomic, that will prevent this scenario.
The text was updated successfully, but these errors were encountered: