[JBoss jBPM] - Problem using multiple timers
by nikosd23
Hi,
We have identified a case in which when using 2 timers in a flow we get exception. To be more specific, we use the following process-definition.xml
<?xml version="1.0" encoding="UTF-8"?>
|
| <process-definition
| xmlns="" name="TestWait">
| <start-state name="start">
| <transition name="" to="SysOut "></transition>
| </start-state>
| <node name="SysOut ">
| <event type="node-enter">
| <action name="action1" class="com.handlers.FlowActionHandler" config-type="constructor">System.out.println('WAITING FOR '+firstTimer);</action></event>
| <transition name="" to="Wait for firstTimer"></transition></node>
| <state name="Wait for firstTimer">
| <timer duedate="4 seconds" transition="resp"><action class="com.handlers.TimeoutActionHandler"></action></timer>
| <transition name="resp" to="SysOut after 1"></transition>
| </state>
| <node name="SysOut after 1">
| <event type="node-enter">
| <action name="action1" class="com.handlers.FlowActionHandler" config-type="constructor">
| System.out.println('After first timer. Going to second timer');
| </action>
| </event>
| <transition name="" to="Wait secondTimer"></transition>
| </node>
| <state name="Wait secondTimer">
| <timer duedate="10 seconds" transition="resp"><action class="com.handlers.TimeoutActionHandler"></action></timer>
| <transition name="resp" to="SysOut after 2"></transition>
| </state>
| <node name="SysOut after 2">
| <event type="node-enter">
| <action name="action1" class="com.handlers.FlowActionHandler" config-type="constructor">System.out.println('After second wait time');
| </action>
| </event>
| <transition name="" to="end1"></transition>
| </node>
| <end-state name="end1"></end-state>
| </process-definition>
The source code of TimeoutActionHandler follows:
public class TimeoutActionHandler implements ActionHandler {
| private static final long serialVersionUID = 1L;
| private Logger log = Logger.getLogger(TimeoutActionHandler.class);
|
| public void execute(ExecutionContext executionContext) throws Exception {
|
| ProcessInstance processInstance = executionContext.getProcessInstance();
| if (processInstance.getRootToken().isLocked()) {
| log.debug("A timer of Flow " + processInstance.getId() + " was skipped. The flow had been resumed.");
| return;
| }
|
| executionContext.setVariable(MESSAGE_CODE, "timeout");
| executionContext.leaveNode();
| }
|
| }
The flow starts and we get in the first wait state, the token waits there for 4 seconds, then we have a System.out.println, then instead of getting in the second wait state, we get the second printout and we get errors. The errors we receive follow:
anonymous wrote : 2009-06-19 10:52:18,645 INFO [STDOUT] WAITING FOR 4 seconds
| 2009-06-19 10:52:18,660 WARN [org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog] Narrowing proxy to class org.jbpm.graph.node.State - this operation breaks ==
| 2009-06-19 10:52:22,225 WARN [org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog] Narrowing proxy to class org.jbpm.job.Timer - this operation breaks ==
| 2009-06-19 10:52:22,310 INFO [STDOUT] After first timer. Going to second timer
| 2009-06-19 10:52:22,327 WARN [org.hibernate.engine.StatefulPersistenceContext.ProxyWarnLog] Narrowing proxy to class org.jbpm.graph.node.State - this operation breaks ==
| 2009-06-19 10:52:22,398 INFO [STDOUT] After second wait time
| 2009-06-19 10:52:22,462 ERROR [org.hibernate.event.def.AbstractFlushingEventListener] Could not synchronize database state with session
| org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.job.Timer#9853]
| at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1765)
| at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2523)
| at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697)
| at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
| at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)
| at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
| at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
| at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
| at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
| at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
| at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:253)
| at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:211)
| at org.jbpm.svc.Services.close(Services.java:222)
| at org.jbpm.JbpmContext.close(JbpmContext.java:139)
| at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:267)
| at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:71)
| 2009-06-19 10:52:22,469 ERROR [org.jbpm.persistence.db.DbPersistenceService] hibernate commit failed
| org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.job.Timer#9853]
| at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1765)
| at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2523)
| at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697)
| at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
| at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)
| at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
| at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
| at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
| at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
| at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
| at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:253)
| at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:211)
| at org.jbpm.svc.Services.close(Services.java:222)
| at org.jbpm.JbpmContext.close(JbpmContext.java:139)
| at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:267)
| at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:71)
| 2009-06-19 10:52:22,471 ERROR [STDERR] org.jbpm.persistence.JbpmPersistenceException: hibernate commit failed
| 2009-06-19 10:52:22,472 ERROR [STDERR] at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:216)
| 2009-06-19 10:52:22,472 ERROR [STDERR] at org.jbpm.svc.Services.close(Services.java:222)
| 2009-06-19 10:52:22,472 ERROR [STDERR] at org.jbpm.JbpmContext.close(JbpmContext.java:139)
| 2009-06-19 10:52:22,472 ERROR [STDERR] at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:267)
| 2009-06-19 10:52:22,472 ERROR [STDERR] at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:71)
| 2009-06-19 10:52:22,472 ERROR [STDERR] Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.job.Timer#9853]
| 2009-06-19 10:52:22,472 ERROR [STDERR] at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1765)
| 2009-06-19 10:52:22,472 ERROR [STDERR] at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2523)
| 2009-06-19 10:52:22,472 ERROR [STDERR] at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697)
| 2009-06-19 10:52:22,472 ERROR [STDERR] at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
| 2009-06-19 10:52:22,472 ERROR [STDERR] at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
| 2009-06-19 10:52:22,472 ERROR [STDERR] at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
| 2009-06-19 10:52:22,472 ERROR [STDERR] at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)
| 2009-06-19 10:52:22,473 ERROR [STDERR] at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
| 2009-06-19 10:52:22,473 ERROR [STDERR] at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
| 2009-06-19 10:52:22,473 ERROR [STDERR] at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
| 2009-06-19 10:52:22,473 ERROR [STDERR] at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
| 2009-06-19 10:52:22,473 ERROR [STDERR] at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
| 2009-06-19 10:52:22,473 ERROR [STDERR] at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:253)
| 2009-06-19 10:52:22,473 ERROR [STDERR] at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:211)
| 2009-06-19 10:52:22,473 ERROR [STDERR] ... 4 more
| 2009-06-19 10:52:22,473 ERROR [org.jbpm.svc.Services] problem closing service 'persistence'
| org.jbpm.persistence.JbpmPersistenceException: hibernate commit failed
| at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:216)
| at org.jbpm.svc.Services.close(Services.java:222)
| at org.jbpm.JbpmContext.close(JbpmContext.java:139)
| at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:267)
| at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:71)
| Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.job.Timer#9853]
| at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1765)
| at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2523)
| at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697)
| at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
| at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)
| at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
| at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
| at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
| at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
| at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
| at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:253)
| at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:211)
| ... 4 more
| 2009-06-19 10:52:22,474 ERROR [org.jbpm.job.executor.JobExecutorThread] problem committing job execution transaction for job 9853-timer(Wait for firstTimer,10:52:22,000) (flow with id 6380)
| org.jbpm.JbpmException: problem closing services {persistence=org.jbpm.persistence.JbpmPersistenceException: hibernate commit failed}
| at org.jbpm.svc.Services.close(Services.java:235)
| at org.jbpm.JbpmContext.close(JbpmContext.java:139)
| at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:267)
| at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:71)
| Caused by: org.jbpm.persistence.JbpmPersistenceException: hibernate commit failed
| at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:216)
| at org.jbpm.svc.Services.close(Services.java:222)
| ... 3 more
| Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.job.Timer#9853]
| at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1765)
| at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2523)
| at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697)
| at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
| at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)
| at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
| at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
| at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
| at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
| at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
| at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:253)
| at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:211)
| ... 4 more
| 2009-06-19 10:52:22,475 ERROR [org.jbpm.job.executor.JobExecutorThread] exception in job executor thread. waiting 5000 milliseconds
| org.jbpm.JbpmException: problem closing services {persistence=org.jbpm.persistence.JbpmPersistenceException: hibernate commit failed}
| at org.jbpm.svc.Services.close(Services.java:235)
| at org.jbpm.JbpmContext.close(JbpmContext.java:139)
| at org.jbpm.job.executor.JobExecutorThread.executeJob(JobExecutorThread.java:267)
| at org.jbpm.job.executor.JobExecutorThread.run(JobExecutorThread.java:71)
| Caused by: org.jbpm.persistence.JbpmPersistenceException: hibernate commit failed
| at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:216)
| at org.jbpm.svc.Services.close(Services.java:222)
| ... 3 more
| Caused by: org.hibernate.StaleObjectStateException: Row was updated or deleted by another transaction (or unsaved-value mapping was incorrect): [org.jbpm.job.Timer#9853]
| at org.hibernate.persister.entity.AbstractEntityPersister.check(AbstractEntityPersister.java:1765)
| at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2523)
| at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2697)
| at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:74)
| at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:250)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:234)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:146)
| at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:298)
| at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:27)
| at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
| at org.hibernate.impl.SessionImpl.managedFlush(SessionImpl.java:338)
| at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:106)
| at org.jbpm.persistence.db.DbPersistenceService.commit(DbPersistenceService.java:253)
| at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:211)
| ... 4 more
You can see both the system outs and the errors produced. We would like to know if someone has faced the same error (and how to resolve it)or if there is a bug of jbpm that is already resolved in the new edition. We are using JBOSS 4.2.2 and jBPM 3.1
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4238723#4238723
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4238723
16 years, 10 months
[JBoss jBPM] - Re: Concurrency Problem
by wjn811
hi kukeltje,
very appreciate your replies!
I'm a new one here. And I even don't know JIRA... What a pity!
I go through the topic you have metioned
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4238433#4238433
If I don't misunderstand that post, changing org.hibernate.dialect can get my problem solved?
However, my org.hibernate.dialect is configured as org.hibernate.dialect.MySQLInnoDBDialect...
<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
| <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
| <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/jbpm4db</property>
| <property name="hibernate.connection.username">root</property>
| <property name="hibernate.connection.password">123456</property>
| <property name="hibernate.hbm2ddl.auto">update</property>
| <property name="hibernate.show.sql">true</property>
|
| <mapping resource="jbpm.repository.hbm.xml" />
| <mapping resource="jbpm.execution.hbm.xml" />
| <mapping resource="jbpm.history.hbm.xml" />
| <mapping resource="jbpm.task.hbm.xml" />
| <mapping resource="jbpm.jpdl.hbm.xml" />
| <mapping resource="jbpm.identity.hbm.xml" />
So I think my problem is different from that. ?
And the ConstraintViolationException
here is because `FK_EXEC_SUPEREXEC` but not `FK_EXEC_INSTANCE` (Yes, it's due to that I use sub-process. Because if I put these 2 fork flows into One process, one embedded into another, tasks in Inner-Fork-Flow will be created twice)
This time I try to be clever to USE SOME KIND OF SEARCH FUNCTIONALITY (I was stupid enough yesterday~~). I learn Google! hahaha
Fortunately, I find this issue list
https://jira.jboss.org/jira/secure/BrowseVersion.jspa?id=10052&versionId=... (And I know JIRA! Fortunately again)
And I find this issue JBPM-2303 UNRESOLVED Exception with a process containing a fork/join
You can touch it:https://jira.jboss.org/jira/browse/JBPM-2303
I ran that tests and got exceptions. I think join/fork flow has its own bugs.
I should go to see what happens in jBPM4. I should have enough time to do that. It's my fault.
I really want to know what's wrong with my code, What is the actual reason caused that exception happens. If it is proved to be a bug, I can sleep well tonight~~ hahaha
Please help me again. Thx!
Or I have to wait for jBPM4 released? hahahaha
My e-mail: crazydog.eric(a)gmail.com
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4238661#4238661
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4238661
16 years, 10 months
[JBoss jBPM] - Re: how to get a processEngine already created?
by shekharv
If you do not want the tables to be redeployed everytime,
change the property below in jbpm.hibernate.cfg.xml
update
If you do not want to delete the users, just comment out those statements in the respective testcases. The testcases do not assume anything as to what can or cannot be present and hence attempt creating a pristine environment and then clean up after they are done, which is what any good test should do(as much as possible).
This is an example from the TaskCandidatesTest. You can delete the identityService calls if u really want to avoid the deletion.
protected void tearDown() throws Exception {
// delete process deployment
repositoryService.deleteDeploymentCascade(deploymentDbid);
// delete identities
identityService.deleteGroup("sales-dept");
identityService.deleteUser("johndoe");
identityService.deleteUser("joesmoe");
super.tearDown();
}
HTH,
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4238653#4238653
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4238653
16 years, 10 months