We are using Cocoon as part of a Content Management System application. The CMS 
is being hosted in production on a Weblogic application server. The client 
using this configuration is periodically experiencing a deadlock issue that 
from the thread dump appears to be coming from the Cocoon application. Could 
you please let us know if this is a known issue. If not, do you have a 
recommendation on how to resolve this issue. 

This deadlock eventually causes the system to run out of memory and crashes the 
server. 
Here is the thread dump that shows the deadlock:

nside Cocoon's FOM_JavaScriptInterpreter.java we have the following two 
methods: 

Method 1 called by [ACTIVE] ExecuteThread: '5' 
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.han 
dleContinuation(FOM_JavaScriptInterpreter.java:850) 
------------------------------------------------ 
handleContinuation() { 
.................. 
ThreadScope kScope = (ThreadScope)k.getParentScope(); 
synchronized (kScope) { -> LOCK A [Blocks on 0xbbb26dd8 (kScope)] 
................ 
} finally { 
..................... 

setSessionScope(kScope); -> LOCK B [Blocks on 0xbd197028 
"AttributeWrapper for kScope" with the call AttributeWrapper.getObject() -> 
LOCK A [Blocks on 0xbbb26dd8 (kScope) with the call 
ScriptableObject.writeObject() <ThreadScope isA ScriptableObject>]] 
.............. 
} 

} 
} 
.. 
.. 
Method 2 called by [ACTIVE] ExecuteThread: '4' 
org.apache.cocoon.components.flow.javascript.fom.FOM_JavaScriptInterpreter.cal 
lFunction(FOM_JavaScriptInterpreter.java:711) 
----------------------------------------------- 
callFunction() { 
...................... 
ThreadScope thrScope = getSessionScope(); -> LOCK B [Blocks on 0xbd197028 
"AttributeWrapper for thrScope == kScope" -> LOCK A [Blocks on 0xbbb26dd8 
(thrScope == kScope) with the call ScriptableObject.writeObject() 
<ThreadScope isA ScriptableObject>]] 

synchronized (thrScope) { -> LOCK A [Blocks on 0xbbb26dd8 (kScope)] 
............... 
} 
} 

To summarize we have: 

[ACTIVE] ExecuteThread: '5' LOCK A, LOCK B, LOCK A 
[ACTIVE] ExecuteThread: '4' LOCK B, LOCK A, LOCK A 

which will lead in time to a deadlock. 


Can we ensure that the same locking order happens in the two methods. 


Thanks for your help and recommendations.


      

Reply via email to