I have a container object which wraps an objectdb database. There is a "putIfAbsent(String id, Object obj)" method which is synchronized and attempts to load an object by id using the EntityManager "find" method. If nothing is returned from the db the passed object is persisted to the db. I have 5 threads which use this method.
In a run today one of the threads seems to have got stuck somewhere in the find. The thread dump looks like:
Name: DEV1-WSAgent-1-Existing/3 State: RUNNABLE Total blocked: 109 Total waited: 80 Stack trace: com.objectdb.o.PGC.C(PGC.java:484) - locked java.lang.Object@881d38 com.objectdb.o.PGC.x(PGC.java:269) com.objectdb.o.PGC.w(PGC.java:230) com.objectdb.o.SNP.B(SNP.java:348) com.objectdb.o.RTT.l(RTT.java:127) com.objectdb.o.RST.l(RST.java:24) com.objectdb.o.RTT.C(RTT.java:179) com.objectdb.o.RST.r(RST.java:110) com.objectdb.o.PGT.q(PGT.java:109) com.objectdb.o.RST.A(RST.java:93) com.objectdb.o.RTT.l(RTT.java:132) com.objectdb.o.RST.l(RST.java:24) com.objectdb.o.TSK.i(TSK.java:146) com.objectdb.o.TSK.f(TSK.java:95) com.objectdb.o.MST.aT(MST.java:582) com.objectdb.o.MST.U2(MST.java:541) com.objectdb.o.WRA.U2(WRA.java:260) com.objectdb.o.LDR.w(LDR.java:381) com.objectdb.o.LDR.v(LDR.java:292) com.objectdb.o.LDR.s(LDR.java:210) com.objectdb.o.OBC.aM(OBC.java:1056) com.objectdb.o.OBC.aK(OBC.java:969) com.objectdb.jpa.EMImpl.find(EMImpl.java:551) - locked com.objectdb.jdo.PMImpl@ae89a com.objectdb.jpa.EMImpl.find(EMImpl.java:474) rbccm.felix.objectdb.workflow.ObjectDbInstanceContainer.putIfAbsent(ObjectDbInstanceContainer.java:108) - locked rbccm.felix.objectdb.workflow.ObjectDbInstanceContainer@9c71a4 rbccm.digest.workflow.execution.WorkflowRunner.workflowCompleteForSomeTasks(WorkflowRunner.java:245) rbccm.digest.workflow.execution.WorkflowRunner.workflowCompleteForSomeTasks(WorkflowRunner.java:204) rbccm.felix.gridservice.workflow.WorkflowService.process(WorkflowService.java:125) rbccm.felix.gridservice.workflow.WorkflowService.process(WorkflowService.java:97) rbccm.felix.gridservice.workflow.WorkflowService.process(WorkflowService.java:75) rbccm.felix.framework.service.ServiceRunner.run(ServiceRunner.java:259) java.lang.Thread.run(Thread.java:662)
A dump from one of the blocked threads looks like:
Name: DEV1-WSAgent-1-Existing/4 State: BLOCKED on rbccm.felix.objectdb.workflow.ObjectDbInstanceContainer@9c71a4 owned by: DEV1-WSAgent-1-Existing/3 Total blocked: 190 Total waited: 69 Stack trace: rbccm.felix.objectdb.workflow.ObjectDbInstanceContainer.putIfAbsent(ObjectDbInstanceContainer.java:102) rbccm.digest.workflow.execution.WorkflowRunner.workflowCompleteForSomeTasks(WorkflowRunner.java:245) rbccm.digest.workflow.execution.WorkflowRunner.workflowCompleteForSomeTasks(WorkflowRunner.java:204) rbccm.felix.gridservice.workflow.WorkflowService.process(WorkflowService.java:125) rbccm.felix.gridservice.workflow.WorkflowService.process(WorkflowService.java:97) rbccm.felix.gridservice.workflow.WorkflowService.process(WorkflowService.java:75) rbccm.felix.framework.service.ServiceRunner.run(ServiceRunner.java:259) java.lang.Thread.run(Thread.java:662)
If you could advise on where the issue might be it'd be much appreciated. Please let me know if you need any further information.