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

Failed to acquire the lock

Open amandeep0440 opened this issue 6 years ago • 7 comments

Hi,

I am getting the below error sometimes, when i am trying to add about 1.5 million objects in the map using about 20 threads. each thread fetches a list of objects and adds it to the map: dataList.parallelStream().forEach(data -> offHeapCAMap.put(data.getId(), data));

I am persisting the map to the disk and used by only single JVM. I delete the persisted file every time a new process starts. i.e. it starts afresh.

Map Config:

ChronicleMapBuilder<Long, Data> mapBuilder=ChronicleMapBuilder.of(Long.class, Data.class)
				.name("data-map")
				.averageValueSize(30000)
				.entries(1500000).putReturnsNull(true).maxBloatFactor(2);

ERROR:

Caused by: java.lang.IllegalStateException: Failed to acquire the lock
	at net.openhft.chronicle.algo.locks.AcquisitionStrategies$SpinLoopOrFailAcquisitionStrategy.end(AcquisitionStrategies.java:89)
	at net.openhft.chronicle.algo.locks.AcquisitionStrategies$SpinLoopAcquisitionStrategy.acquire(AcquisitionStrategies.java:66)
	at net.openhft.chronicle.hash.impl.VanillaChronicleHash.globalMutableStateLock(VanillaChronicleHash.java:736)
	at net.openhft.chronicle.hash.impl.VanillaChronicleHash.allocateTier(VanillaChronicleHash.java:760)
	at net.openhft.chronicle.map.impl.CompiledMapQueryContext.nextTier(CompiledMapQueryContext.java:3123)
	at net.openhft.chronicle.map.impl.CompiledMapQueryContext.alloc(CompiledMapQueryContext.java:3484)
	at net.openhft.chronicle.map.impl.CompiledMapQueryContext.initEntryAndKey(CompiledMapQueryContext.java:3502)
	at net.openhft.chronicle.map.impl.CompiledMapQueryContext.putEntry(CompiledMapQueryContext.java:3995)
	at net.openhft.chronicle.map.impl.CompiledMapQueryContext.doInsert(CompiledMapQueryContext.java:4184)
	at net.openhft.chronicle.map.MapEntryOperations.insert(MapEntryOperations.java:153)
	at net.openhft.chronicle.map.impl.CompiledMapQueryContext.insert(CompiledMapQueryContext.java:4107)
	at net.openhft.chronicle.map.MapMethods.put(MapMethods.java:88)
	at net.openhft.chronicle.map.VanillaChronicleMap.put(VanillaChronicleMap.java:712)

amandeep0440 avatar Jul 05 '19 14:07 amandeep0440

I dont think it is related to volume of objects. I noticed its happening with 30K objects too.

amandeep0440 avatar Jul 05 '19 14:07 amandeep0440

I'm also getting the same error frequently. Any solution yet?

ksiu avatar Mar 01 '20 04:03 ksiu

Where is the chronicle map file stored. Is it on the local disk. ?

RobAustin avatar Mar 01 '20 07:03 RobAustin

Yes, it's on the local disk

ksiu avatar Mar 02 '20 18:03 ksiu

I am getting the same error.. Error is same but at Chroniclemap.compute. I am using 3.14.5 version. Tried to update version but it did not solve the issue. The map is saved to disk in my case ; how to reproduce the issue- This occurs randomly and possibly with a large data set .Any suggestions or workarounds?

Exception in thread "main" java.lang.IllegalStateException: Failed to acquire the lock

  | at net.openhft.chronicle.algo.locks.AcquisitionStrategies$SpinLoopOrFailAcquisitionStrategy.end(AcquisitionStrategies.java:89) |   | at net.openhft.chronicle.algo.locks.AcquisitionStrategies$SpinLoopOrFailAcquisitionStrategy.end(AcquisitionStrategies.java:89)   | at net.openhft.chronicle.algo.locks.AcquisitionStrategies$SpinLoopAcquisitionStrategy.acquire(AcquisitionStrategies.java:66) |   | at net.openhft.chronicle.algo.locks.AcquisitionStrategies$SpinLoopAcquisitionStrategy.acquire(AcquisitionStrategies.java:66)   | at net.openhft.chronicle.hash.impl.VanillaChronicleHash.globalMutableStateLock(VanillaChronicleHash.java:736) |   | at net.openhft.chronicle.hash.impl.VanillaChronicleHash.globalMutableStateLock(VanillaChronicleHash.java:765)   | at net.openhft.chronicle.hash.impl.VanillaChronicleHash.allocateTier(VanillaChronicleHash.java:760) |   | at net.openhft.chronicle.hash.impl.VanillaChronicleHash.allocateTier(VanillaChronicleHash.java:787)   | at net.openhft.chronicle.map.impl.CompiledMapQueryContext.nextTier(CompiledMapQueryContext.java:3123) |   | at net.openhft.chronicle.map.impl.CompiledMapQueryContext.nextTier(CompiledMapQueryContext.java:3126)   | at net.openhft.chronicle.map.impl.CompiledMapQueryContext.alloc(CompiledMapQueryContext.java:3484) |   | at net.openhft.chronicle.map.impl.CompiledMapQueryContext.alloc(CompiledMapQueryContext.java:3487)   | at net.openhft.chronicle.map.impl.CompiledMapQueryContext.initEntryAndKey(CompiledMapQueryContext.java:3502) |   | at net.openhft.chronicle.map.impl.CompiledMapQueryContext.initEntryAndKey(CompiledMapQueryContext.java:3505)   | at net.openhft.chronicle.map.impl.CompiledMapQueryContext.putEntry(CompiledMapQueryContext.java:3995) |   | at net.openhft.chronicle.map.impl.CompiledMapQueryContext.putEntry(CompiledMapQueryContext.java:3998)   | at net.openhft.chronicle.map.impl.CompiledMapQueryContext.doInsert(CompiledMapQueryContext.java:4184) |   | at net.openhft.chronicle.map.impl.CompiledMapQueryContext.doInsert(CompiledMapQueryContext.java:4187)   | at net.openhft.chronicle.map.MapEntryOperations.insert(MapEntryOperations.java:153) |   | at net.openhft.chronicle.map.MapEntryOperations.insert(MapEntryOperations.java:157)   | at net.openhft.chronicle.map.impl.CompiledMapQueryContext.insert(CompiledMapQueryContext.java:4107) |   | at net.openhft.chronicle.map.impl.CompiledMapQueryContext.insert(CompiledMapQueryContext.java:4110)   | at net.openhft.chronicle.map.MapMethods.put(MapMethods.java:88) |   | at net.openhft.chronicle.map.MapMethods.compute(MapMethods.java:350)   | at net.openhft.chronicle.map.VanillaChronicleMap.put(VanillaChronicleMap.java:712) |   | at net.openhft.chronicle.map.VanillaChronicleMap.compute(VanillaChronicleMap.java:747)

amritkumar123 avatar Feb 17 '21 10:02 amritkumar123

This is related to https://github.com/OpenHFT/Chronicle-Map/issues/376

minborg avatar Jan 04 '22 14:01 minborg

@amritkumar123 @amandeep0440 @ksiu could you re-rest now that #376 has been fixed?

JerryShea avatar Sep 19 '22 02:09 JerryShea

Closing as assumed fixed by #376

JerryShea avatar Jan 23 '23 21:01 JerryShea