[
http://jira.jboss.com/jira/browse/JBPM-983?page=comments#action_12367164 ]
Edward Staub commented on JBPM-983:
-----------------------------------
I suppose I should describe the fixes I'm not publishing.
I made a static map reflecting all processes that are currently locked for exclusive
execution. The map contains process id as key, and Thread, lock count, and process id in
a class as the value. The lock count is needed to allow a thread to lock/unlock a process
more than once in a nested fashion. All use of the map is synchronized on the map.
Whenever a process instance is in use by a job, it is locked by adding it to the map.
After all jobs for a process are completed and committed in JobExecutorThread, all process
locks held by that thread are released (deleted from the map), by scanning the map for the
thread.
The map is synchronize-locked during querying for a job. When job(s) have been selected,
their process-instance is locked and then the synchronization-lock is released. This
prevents the problem where, if a new job is spawned while old ones are running on a
process instance, the new job may be picked up by another thread immediately.
When a subprocess is created in ProcessState, it is locked until the job is completed.
This prevents execution of jobs on the new process before it has been committed.
When a subprocess completes in ProcessState, there is an attempt to lock the parent
process. If that succeeds, execution proceeds normally. If the lock is already held by
someone else, a job is spawned to wake up the parent process.
concurrent process execution fails
----------------------------------
Key: JBPM-983
URL:
http://jira.jboss.com/jira/browse/JBPM-983
Project: JBoss jBPM
Issue Type: Bug
Components: Core Engine
Affects Versions: jBPM jPDL 3.2
Environment: Hypersonic in-memory database, JobExecutor configured with 5
threads
Reporter: Alexander Schlett
Assigned To: Tom Baeyens
Attachments: SimpleTest.java, SimpleTest.java, SimpleTest.java, SimpleTest.java,
SimpleTest.java
concurrent execution of async nodes with multiple JobExecutor threads fails. the effect
is:
1) job sync within JobExecutor fails due to org.hibernate.StaleObjectStateException
2) process gets stuck in join node and never ends
junit test for this is attached, it's a simple process with just a fork and a join
and some scripts inbetween.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://jira.jboss.com/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira