there is potential deadLock for lock order is different for PersistenceManager$Default.store and BinaryStorer$Default.storeAll
Environment Details
- EclipseStore Version: 1.2.0
- JDK version: OpenJDK Runtime Environment Zulu21.32+17-CA (build 21.0.2+13-LTS)
- OS:
- os.arch=amd64 os.name=Linux os.version=3.10.0-1160.105.1.el7.x86_64
- Used frameworks: Spingboot 3.2.2
Describe the bug
We write ourself Map class to store object to eclipse. it is running multi-thread, but it block for deadlock, I get the jstack ,it has dead-lock for PersistenceManager$Default.store and BinaryStorer$Default.storeAll has different lock order.
at org.eclipse.serializer.persistence.types.PersistenceManager$Default.store(PersistenceManager.java:2998) at org.eclipse.serializer.persistence.binary.types.BinaryStorer$Default.storeAll(BinaryStorer.java:460)
you can see the screenshot
To Reproduce
for the same Persister, to store object by PersistenceManager$Default.store and .BinaryStorer$Default.storeAll in mulit-thread
Expected behavior
PersistenceManager$Default.store and BinaryStorer$Default.storeAll has the same lock order, then there is no deadlock happen
Screenshots
Additional context
Add any other context about the problem here.
Many thanks for your bug report.
Is it possible that you update to version 2.0.0 or later? There are some changes done to the BinaryStorer with https://github.com/eclipse-serializer/serializer/pull/143].
I was not yet able to reproduce the deadlock. Please let me know if it occurs with version 2 or later again.
~~Issue has been confirmed to exist still in version 2.1.3, see #414~~
issue #414 is not exactly the same, see traces
Hi, I have another potential cause of the deadlock. Do you call an of the “Store” methods from within another storer that has already acquired a lock? If so, this would explain why you get the deadlock. You must never do that! If you want to persist a referenced object from within a TypeHandler always use one of the apply methods from a PersistenceStoreHandler.