Chronicle-Map icon indicating copy to clipboard operation
Chronicle-Map copied to clipboard

"Failed to acquire the lock" Exception

Open phishman3579 opened this issue 6 months ago • 5 comments

From VanillaChronicleHash

java.lang.IllegalStateException: java.lang.IllegalStateException: Failed to acquire the lock

I've been seeing this exception occasionally when using chronicle map. From the previous issues (https://github.com/OpenHFT/Chronicle-Map/issues/376) the problem was thought to be fixed. I am currently using version 3.24ea3. We've been experimenting locally and have found that making the lock a class local field seems to have mitigated the exception. See https://github.com/OpenHFT/Chronicle-Map/blob/84f4a8ec30963582f3ac71eef4f4f9d2af217fbf/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java#L93 https://github.com/OpenHFT/Chronicle-Map/blob/84f4a8ec30963582f3ac71eef4f4f9d2af217fbf/src/main/java/net/openhft/chronicle/hash/impl/VanillaChronicleHash.java#L95

private final LockingStrategy GLOBAL_MUTABLE_STATE_LOCKING_STRATEGY = VanillaReadWriteUpdateWithWaitsLockingStrategy.instance();
private final TryAcquireOperation<LockingStrategy> GLOBAL_MUTABLE_STATE_LOCK_TRY_ACQUIRE_OPERATION = TryAcquireOperations.lock();

Is there a reason why that lock is a static field?

phishman3579 avatar Dec 14 '23 15:12 phishman3579