Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
2.2, 2.4
-
None
Description
In JCR-2650 a potential deadlock in SessionItemStateManager.stateModified() got fixed by postponing the work to the save() call.
Unfortunately this still leaves the stateCreated() method vulnerable to a similar (though much less likely) deadlock scenario (observed in Jackrabbit 2.2.x):
Thread A:
at org.apache.jackrabbit.core.state.NodeState.copy(NodeState.java:118)
- waiting to lock <0x00007ffec8ddfa18> (a org.apache.jackrabbit.core.state.NodeState)
- locked <0x00007ffec8ddf9d8> (a org.apache.jackrabbit.core.state.NodeState)
at org.apache.jackrabbit.core.state.ItemState.pull(ItemState.java:152) - locked <0x00007ffec8ddf9d8> (a org.apache.jackrabbit.core.state.NodeState)
at org.apache.jackrabbit.core.state.SessionItemStateManager.stateCreated(SessionItemStateManager.java:791)
at org.apache.jackrabbit.core.state.StateChangeDispatcher.notifyStateCreated(StateChangeDispatcher.java:94)
at org.apache.jackrabbit.core.state.LocalItemStateManager.stateCreated(LocalItemStateManager.java:428)
at org.apache.jackrabbit.core.state.StateChangeDispatcher.notifyStateCreated(StateChangeDispatcher.java:94)
at org.apache.jackrabbit.core.state.SharedItemStateManager.stateCreated(SharedItemStateManager.java:398)
at org.apache.jackrabbit.core.state.ItemState.notifyStateCreated(ItemState.java:231)
at org.apache.jackrabbit.core.state.ChangeLog.persisted(ChangeLog.java:309)
at org.apache.jackrabbit.core.state.SharedItemStateManager$Update.end(SharedItemStateManager.java:777)
at org.apache.jackrabbit.core.state.SharedItemStateManager.update(SharedItemStateManager.java:1488)
at org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:351)
at org.apache.jackrabbit.core.state.XAItemStateManager.update(XAItemStateManager.java:354)
at org.apache.jackrabbit.core.state.LocalItemStateManager.update(LocalItemStateManager.java:326)
at org.apache.jackrabbit.core.state.SessionItemStateManager.update(SessionItemStateManager.java:289)
at org.apache.jackrabbit.core.ItemSaveOperation.perform(ItemSaveOperation.java:258)
at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)
at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91)
at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:329)
Thread B:
at org.apache.jackrabbit.core.state.NodeState.copy(NodeState.java:119)
- waiting to lock <0x00007ffec8ddf9d8> (a org.apache.jackrabbit.core.state.NodeState)
- locked <0x00007ffec8ddfa18> (a org.apache.jackrabbit.core.state.NodeState)
at org.apache.jackrabbit.core.NodeImpl.makePersistent(NodeImpl.java:869) - locked <0x00007ffec8ddfa18> (a org.apache.jackrabbit.core.state.NodeState)
at org.apache.jackrabbit.core.ItemSaveOperation.persistTransientItems(ItemSaveOperation.java:836)
at org.apache.jackrabbit.core.ItemSaveOperation.perform(ItemSaveOperation.java:243)
at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)
at org.apache.jackrabbit.core.ItemImpl.perform(ItemImpl.java:91)
at org.apache.jackrabbit.core.ItemImpl.save(ItemImpl.java:329)
at org.apache.jackrabbit.core.session.SessionSaveOperation.perform(SessionSaveOperation.java:42)
at org.apache.jackrabbit.core.session.SessionState.perform(SessionState.java:200)
at org.apache.jackrabbit.core.SessionImpl.perform(SessionImpl.java:355)
at org.apache.jackrabbit.core.SessionImpl.save(SessionImpl.java:758)
IIUC this can only occur when two sessions are concurrently importing a node with the same UUID.