[JBoss jBPM] - Re: Concurrency Problem
by wjn811
It's me again...
I will post data generated by jBPM in MySQL just after exceptions occur
SQL
| SELECT * FROM jbpm4_execution\G;
|
Data in jbpm4_execution
| *************************** 1. row ***************************
| DBID_: 1
| CLASS_: jpdl
| DBVERSION_: 1
| ACTIVITYNAME_: NULL
| PROCDEFID_: concurruncy-1
| HASVARS_:
| NAME_: NULL
| KEY_: NULL
| ID_: concurruncy.1
| STATE_: inactive-concurrent-root
| SUSPHISTSTATE_: NULL
| PRIORITY_: 0
| HISACTINST_: NULL
| PARENT_: NULL
| INSTANCE_: 1
| SUPEREXEC_: NULL
| SUBPROCINST_: NULL
| PARENT_IDX_: NULL
| *************************** 2. row ***************************
| DBID_: 2
| CLASS_: jpdl
| DBVERSION_: 1
| ACTIVITYNAME_: Subprocess1
| PROCDEFID_: concurruncy-1
| HASVARS_:
| NAME_: to task1
| KEY_: NULL
| ID_: concurruncy.1.to task1[0]
| STATE_: active-concurrent
| SUSPHISTSTATE_: NULL
| PRIORITY_: 0
| HISACTINST_: 1
| PARENT_: 1
| INSTANCE_: 1
| SUPEREXEC_: NULL
| SUBPROCINST_: 4
| PARENT_IDX_: 0
| *************************** 3. row ***************************
| DBID_: 3
| CLASS_: jpdl
| DBVERSION_: 1
| ACTIVITYNAME_: join2
| PROCDEFID_: concurruncy-1
| HASVARS_:
| NAME_: to task2
| KEY_: NULL
| ID_: concurruncy.1.to task2[0]
| STATE_: inactive-join
| SUSPHISTSTATE_: NULL
| PRIORITY_: 0
| HISACTINST_: 2
| PARENT_: 1
| INSTANCE_: 1
| SUPEREXEC_: NULL
| SUBPROCINST_: NULL
| PARENT_IDX_: 1
| *************************** 4. row ***************************
| DBID_: 4
| CLASS_: jpdl
| DBVERSION_: 1
| ACTIVITYNAME_: NULL
| PROCDEFID_: sub_concurrency-1
| HASVARS_:
| NAME_: NULL
| KEY_: NULL
| ID_: sub_concurrency.4
| STATE_: inactive-concurrent-root
| SUSPHISTSTATE_: NULL
| PRIORITY_: 0
| HISACTINST_: NULL
| PARENT_: NULL
| INSTANCE_: 4
| SUPEREXEC_: 2
| SUBPROCINST_: NULL
| PARENT_IDX_: NULL
| *************************** 5. row ***************************
| DBID_: 5
| CLASS_: jpdl
| DBVERSION_: 1
| ACTIVITYNAME_: sub_join
| PROCDEFID_: sub_concurrency-1
| HASVARS_:
| NAME_: to task4
| KEY_: NULL
| ID_: sub_concurrency.4.to task4[0]
| STATE_: inactive-join
| SUSPHISTSTATE_: NULL
| PRIORITY_: 0
| HISACTINST_: 3
| PARENT_: 4
| INSTANCE_: 4
| SUPEREXEC_: NULL
| SUBPROCINST_: NULL
| PARENT_IDX_: 0
| *************************** 6. row ***************************
| DBID_: 6
| CLASS_: jpdl
| DBVERSION_: 0
| ACTIVITYNAME_: task3
| PROCDEFID_: sub_concurrency-1
| HASVARS_:
| NAME_: to task3
| KEY_: NULL
| ID_: sub_concurrency.4.to task3[0]
| STATE_: active-concurrent
| SUSPHISTSTATE_: NULL
| PRIORITY_: 0
| HISACTINST_: 4
| PARENT_: 4
| INSTANCE_: 4
| SUPEREXEC_: NULL
| SUBPROCINST_: NULL
| PARENT_IDX_: 1
| 6 rows in set (0.00 sec)
|
Look at row 4. Its SUPEREXEC_ refers to row2(DBID_=2)
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4238364#4238364
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4238364
16 years, 10 months
[JBoss jBPM] - Concurrency Problem
by wjn811
Hi guys,
I am a poor java developer... and I'm on my way pushing myself to learn more.
I met a problem when I use jBPM4.0CR1.
The problem is described as following,
My boss asked me to make a workflow, which mainly contains 2 concurrency flows. And unfortunately, one is contained in another...
That means, a super process has a 'Con1' fork activity. And among the executions under that 'Con1', there is a sub-process, which also contains another fork activity 'Con2'.
Here is jpdls, (concurrency.jpdl.xml & sub_concurrency.jpdl.xml)
I hope you will understand what I am talking about~
concurrency.jpdl.xml
| <process name="concurruncy" xmlns="http://jbpm.org/4.0/jpdl">
| <start g="13,103,48,48" name="start1">
| <transition g="-52,-22" name="to fork1" to="fork1"/>
| </start>
| <end g="818,27,48,48" name="end1"/>
| <fork g="100,101,48,48" name="fork1">
| <transition g="-52,-22" name="to task1" to="task1"/>
| <transition name="to task2" to="task2" g="-52,-22"/>
| </fork>
| <task assignee="#{u1}" g="240,145,92,52" name="task1">
| <transition g="-56,-21" name="to Subprocess1" to="Subprocess1"/>
| </task>
| <task assignee="#{u2}" g="223,12,92,52" name="task2">
| <transition g="-49,-22" name="to join2" to="join2"/>
| </task>
| <join g="681,26,48,48" name="join2">
| <transition g="-50,-22" name="to end1" to="end1"/>
| </join>
| <sub-process g="420,139,92,52" name="Subprocess1" sub-process-key="sub_concurrency">
| <parameter-in subvar="u2" var="u2"/>
| <parameter-in subvar="u4" var="u4"/>
| <transition g="-49,-22" name="to join2" to="join2"/>
| </sub-process>
| </process>
|
sub_concurrency.jpdl.xml
| <process name="sub_concurrency" xmlns="http://jbpm.org/4.0/jpdl">
| <start g="89,110,48,48" name="start1">
| <transition g="-52,-22" name="to fork1" to="fork1"/>
| </start>
| <end g="596,115,48,48" name="sub_end"/>
| <fork g="200,107,48,48" name="fork1">
| <transition g="-52,-22" name="to task4" to="task4"/>
| <transition name="to task3" to="task3" g="-52,-22"/>
| </fork>
| <task assignee="#{u3}" g="304,60,92,52" name="task3">
| <transition g="-28,-25" name="to sub_join" to="sub_join"/>
| </task>
| <task assignee="#{u4}" g="309,150,92,52" name="task4">
| <transition g="-27,3" name="to sub_join" to="sub_join"/>
| </task>
| <join g="483,113,48,48" name="sub_join">
| <transition g="-36,-25" name="to sub_end" to="sub_end"/>
| </join>
| </process>
|
I'm sorry. I apply these nonsense names on assignees and task names :)
I make a JUnit test to run this work flow.
Then, java exceptions appears,
| 10:46:30,185 FIN | [Execution] execution[to task4] ends
| 10:46:30,187 FIN | [Execution] execution[to task3] ends
| 10:46:30,187 FIN | [ExecuteActivity] executing activity(sub_end)
| 10:46:30,188 FIN | [Execution] process-instance ends with state ended
| 10:46:30,203 FIN | [Signal] execution[to task1] signals activity(Subprocess1)
| 10:46:30,204 WRN | [ProxyWarnLog] Narrowing proxy to class org.jbpm.jpdl.internal.model.JpdlExecution - this operation breaks ==
| 10:46:30,204 FIN | [ExecuteActivity] execution[to task1] executes activity(join2)
| 10:46:30,213 FIN | [Execution] execution[to task1] ends
| 10:46:30,215 FIN | [Execution] execution[to task2] ends
| 10:46:30,215 FIN | [ExecuteActivity] executing activity(end1)
| 10:46:30,215 FIN | [Execution] process-instance ends with state ended
| 10:46:30,228 WRN | [JDBCExceptionReporter] SQL Error: 1451, SQLState: 23000
| 10:46:30,229 SEV | [JDBCExceptionReporter] Cannot delete or update a parent row: a foreign key constraint fails (`jbpm4db/jbpm4_execution`, CONSTRAINT `FK_EXEC_SUPEREXEC` FOREIGN KEY (`SUPEREXEC_`) REFERENCES `jbpm4_execution` (`DBID_`))
| ### EXCEPTION ###########################################
| 10:46:30,229 SEV | [AbstractFlushingEventListener] Could not synchronize database state with session
| org.hibernate.exception.ConstraintViolationException: could not delete: [org.jbpm.jpdl.internal.model.JpdlExecution#2]
| at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:94)
| at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
| at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2569)
| at org.hibernate.persister.entity.AbstractEntityPersister.delete(AbstractEntityPersister.java:2725)
| at org.hibernate.action.EntityDeleteAction.execute(EntityDeleteAction.java:97)
| at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:279)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:263)
| at org.hibernate.engine.ActionQueue.executeActions(ActionQueue.java:172)
| at org.hibernate.event.def.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:321)
| at org.hibernate.event.def.DefaultAutoFlushEventListener.onAutoFlush(DefaultAutoFlushEventListener.java:64)
| at org.hibernate.impl.SessionImpl.autoFlushIfRequired(SessionImpl.java:996)
| at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1141)
| at org.hibernate.impl.QueryImpl.list(QueryImpl.java:102)
| at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835)
| at org.jbpm.pvm.internal.hibernate.DbSessionImpl.findProcessInstanceById(DbSessionImpl.java:175)
| at org.jbpm.pvm.internal.hibernate.DbSessionImpl.deleteProcessInstance(DbSessionImpl.java:225)
| at org.jbpm.pvm.internal.model.ExecutionImpl.end(ExecutionImpl.java:354)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
| at org.jbpm.pvm.internal.model.ExecutionImpl_$$_javassist_3.end(ExecutionImpl_$$_javassist_3.java)
| at org.jbpm.pvm.internal.model.ExecutionImpl.end(ExecutionImpl.java:364)
| at org.jbpm.jpdl.internal.activity.EndActivity.execute(EndActivity.java:82)
| at org.jbpm.jpdl.internal.activity.EndActivity.execute(EndActivity.java:45)
| at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
| at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:625)
| at org.jbpm.pvm.internal.model.ExecutionImpl.fire(ExecutionImpl.java:535)
| at org.jbpm.pvm.internal.model.ExecutionImpl.take(ExecutionImpl.java:441)
| at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
| at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
| at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
| at java.lang.reflect.Method.invoke(Method.java:597)
| at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
| at org.jbpm.pvm.internal.model.ExecutionImpl_$$_javassist_3.take(ExecutionImpl_$$_javassist_3.java)
|
I find that all the execution has been well finished and inactive executions will be deleted from jbpm4_exection
| 10:53:39,305 FIN | [ExecuteActivity] execution[to task1] executes activity(join2)
| 10:53:39,311 FIN | [Execution] execution[to task1] ends
| 10:53:39,314 FIN | [Execution] execution[to task2] ends
| 10:53:39,314 FIN | [ExecuteActivity] executing activity(end1)
| 10:53:39,314 FIN | [Execution] process-instance ends with state ended
|
But failed because of foreign key constraint. I dont know why...
Do I make the problem clearly described?
Please help me~ Thx!
My mail: crazydog.eric(a)gmail.com
-----------------------------------------------------
And I find that if I add a state activity just after sub-process, which will join together with task2, things go right! Is it a kind of answer?
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4238362#4238362
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4238362
16 years, 10 months
[JBoss jBPM] - Re: jBPM 4 CR1 AsyncActivity Unit Test fails due to FK const
by joshsiaw
Here you go:
jbpm.cfg.xml file:
| <?xml version="1.0" encoding="UTF-8"?>
|
| <jbpm-configuration>
|
| <import resource="jbpm.default.cfg.xml" />
| <import resource="jbpm.tx.hibernate.cfg.xml" />
| <import resource="jbpm.jpdl.cfg.xml" />
| <import resource="jbpm.identity.cfg.xml" />
|
| <!-- Job executor is excluded for running the example test cases. -->
| <!-- To enable timers and messages in production use, this should be included. -->
| <!--
| <import resource="jbpm.jobexecutor.cfg.xml" />
| -->
|
| <import resource="jbpm.mail.templates.examples.xml" />
|
| </jbpm-configuration>
|
jbpm.hibernate.cfg.xml file:
| <?xml version="1.0" encoding="utf-8"?>
|
| <!DOCTYPE hibernate-configuration PUBLIC
| "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
| "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
|
| <hibernate-configuration>
| <session-factory>
|
| <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
| <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
| <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/jbpmdb</property>
| <property name="hibernate.connection.username">root</property>
| <property name="hibernate.connection.password">p4ssw0rd</property>
| <property name="hibernate.hbm2ddl.auto">update</property>
| <property name="hibernate.format_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" />
|
| </session-factory>
| </hibernate-configuration>
|
logging.properties file:
| handlers= java.util.logging.ConsoleHandler
| redirect.commons.logging = enabled
|
| java.util.logging.ConsoleHandler.level = FINE
| java.util.logging.ConsoleHandler.formatter = org.jbpm.internal.log.LogFormatter
|
| org.jbpm.level=FINE
| # org.jbpm.pvm.internal.tx.level=FINE
| # org.jbpm.pvm.internal.wire.level=FINE
| # org.jbpm.pvm.internal.util.level=FINE
|
| org.hibernate.level=INFO
| org.hibernate.cfg.SettingsFactory.level=SEVERE
| org.hibernate.cfg.HbmBinder.level=SEVERE
| # org.hibernate.SQL.level=FINEST
| # org.hibernate.type.level=FINEST
| # org.hibernate.tool.hbm2ddl.SchemaExport.level=FINEST
| # org.hibernate.transaction.level=FINEST
|
I don't have a -ds.xml file though. Is that needed? I ran the build.xml using ant with the datasource settings modified in the build file. This is what I modified:
| <!-- DEFAULT PROPERTY VALUES -->
| <property name="database" value="mysql" />
| <property name="jbpm.parent.dir" value="../.." />
| <property name="jbpm.version" value="4.0.CR1" />
| <property name="jboss.version" value="5.0.0.GA" />
| <property name="jbpm.home" value="${jbpm.parent.dir}/jbpm-${jbpm.version}" />
|
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4238359#4238359
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4238359
16 years, 10 months
[JBoss jBPM] - Deleting a ProcessInstance in jBPM 3
by starbuxman
apologies if this is spam. I sent it to the forum mailing address but it didnt seem like it took, so i suspect i Have to post here instead. Anyway, apologies:
Hello,
I'm wondering if there's any recipes for deleting a ProcessInstance
from the DBMS in jBPM 3?
I realize that it's, essentially, just a Hibernate object graph and
that tailing through and scorching the earth on all the foreign keys,
as I would with any Hibernate model, ought to do it.. Having said
that, I'd love to avoid doing it if somebody else has already dealt
with it, because it seems awfully hairy from where I'm sitting :-)
Is there some hidden API method unnoticed? Basically, as processes
finish, I (almost ) have a trigger that will automatically check to
see if the node that was just finished is the last for the process
instance and it inserts a record into an audit table, so that I can
easily verify process X was run for customer X with variables 1,2, and
3. I then want to purge the process instance itself from the database.
Any ideas? Is this best handled from Java or from the DBMS? I like the
idea of handling it from Java since its more easily "read" for a Java
dev, plus, it's still transactional, and may not be that much slower
:-)
Issues I can imagine are basically, what happens in the case of
concurrences, or subprocesses? If I create a concurrence and that in
turn forks 10 subprocesses, and one of the 10 subprocesses finishes, i
want it to try and delete itself. When all 10 subprocesses have
finished, the super process (the creator of the subprocesses) should
evaluate that it has no outstanding branches and then try and delete
itself. You see?
Thanks,
Josh
View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4238358#4238358
Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4238358
16 years, 10 months