[JBoss JIRA] Created: (JBPM-2535) Exception during async execution causes multiple instances of the same task being inserted to the database
by Peter Horvath (JIRA)
Exception during async execution causes multiple instances of the same task being inserted to the database
----------------------------------------------------------------------------------------------------------
Key: JBPM-2535
URL: https://jira.jboss.org/jira/browse/JBPM-2535
Project: jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Runtime Engine
Affects Versions: jBPM 4.x
Reporter: Peter Horvath
If a task is reached in an asynchronous execution and notification email sending (or any automated activity)
throws and exception new task instances are inserted to the database on every retry of the asynchronous job.
ExecuteJobCmd creates a JobExceptionHandler to re-try the execution of the job.
Since org.jbpm.jpdl.internal.activity.TaskActivity.execute() method is called on every retry,
and this method creates a new task instance each time it is called, multiple instances of the
same task with the same execution id will be inserted to the database.
All operations that try to query the task by execution will fail due to a NonUniqueResultException.
Example process definition: (note continue="async" attribute on start tag)
<?xml version="1.0" encoding="UTF-8"?>
<process name="task_error" xmlns="http://jbpm.org/4.0/jpdl">
<start name="start1" g="93,78,48,48" continue="async">
<transition name="to Test Task" to="Test Task" g="1,-20"/>
</start>
<end name="end1" g="315,236,48,48"/>
<task name="Test Task" g="178,159,92,52" assignee="johnsmith">
<notification>
<to users="${task.assignee}"/>
<cc addresses="invalid@email@address"/>
<subject>${task.name}</subject>
<text>
<![CDATA[Hi ${task.assignee},
Task "${task.name}" has been assigned to you.
${task.description}
Sent by JBoss jBPM
]]>
</text>
</notification>
<transition name="to end1" to="end1" g="-6,-22"/>
</task>
</process>
The notification email will fail (email sender throws an exception) because of the invalid email address (invalid@email@address) that is set in CC tag.
First run fails because of this invalid email address:
SEVERE: exception while executing 'ExecuteActivityMessage[25]'
org.jbpm.api.JbpmException: failed to add invalid@email@address to recipients of type Cc
at org.jbpm.pvm.internal.email.impl.MailProducerImpl.fillRecipients(MailProducerImpl.java:197)
at org.jbpm.pvm.internal.email.impl.MailProducerImpl.fillRecipients(MailProducerImpl.java:180)
at org.jbpm.pvm.internal.email.impl.MailProducerImpl.produce(MailProducerImpl.java:79)
at org.jbpm.jpdl.internal.activity.MailListener.notify(MailListener.java:56)
at org.jbpm.pvm.internal.model.op.ExecuteEventListener.perform(ExecuteEventListener.java:81)
at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:637)
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_4.performAtomicOperationSync(ExecutionImpl_$$_javassist_4.java)
at org.jbpm.pvm.internal.model.op.ExecuteActivityMessage.execute(ExecuteActivityMessage.java:46)
at org.jbpm.pvm.internal.cmd.ExecuteJobCmd.execute(ExecuteJobCmd.java:74)
at org.jbpm.pvm.internal.cmd.ExecuteJobCmd.execute(ExecuteJobCmd.java:41)
at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
at org.jbpm.pvm.internal.spring.CommandTransactionCallback.doInTransaction(CommandTransactionCallback.java:50)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:79)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at org.jbpm.pvm.internal.jobexecutor.JobExecutorThread.run(JobExecutorThread.java:63)
Caused by: javax.mail.internet.AddressException: Illegal character in domain in string ``invalid@email@address''
at javax.mail.internet.InternetAddress.checkAddress(InternetAddress.java:947)
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:833)
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:569)
at javax.mail.internet.InternetAddress.parse(InternetAddress.java:546)
at org.jbpm.pvm.internal.email.impl.MailProducerImpl.fillRecipients(MailProducerImpl.java:194)
... 21 more
First retry fails since there are two tasks with the same execution id in the database (query returns 2 results):
SEVERE: exception while executing 'ExecuteActivityMessage[25]'
org.hibernate.NonUniqueResultException: query did not return a unique result: 2
at org.hibernate.impl.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:844)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835)
at org.jbpm.pvm.internal.hibernate.DbSessionImpl.findTaskByExecution(DbSessionImpl.java:382)
at org.jbpm.jpdl.internal.activity.MailListener.notify(MailListener.java:50)
at org.jbpm.pvm.internal.model.op.ExecuteEventListener.perform(ExecuteEventListener.java:81)
at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:637)
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_4.performAtomicOperationSync(ExecutionImpl_$$_javassist_4.java)
at org.jbpm.pvm.internal.model.op.ExecuteActivityMessage.execute(ExecuteActivityMessage.java:46)
at org.jbpm.pvm.internal.cmd.ExecuteJobCmd.execute(ExecuteJobCmd.java:74)
at org.jbpm.pvm.internal.cmd.ExecuteJobCmd.execute(ExecuteJobCmd.java:41)
at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
at org.jbpm.pvm.internal.spring.CommandTransactionCallback.doInTransaction(CommandTransactionCallback.java:50)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:79)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at org.jbpm.pvm.internal.jobexecutor.JobExecutorThread.run(JobExecutorThread.java:63)
Second retry fails since there are three tasks with the same execution id in the database (query returns 3 results):
SEVERE: exception while executing 'ExecuteActivityMessage[25]'
org.hibernate.NonUniqueResultException: query did not return a unique result: 3
at org.hibernate.impl.AbstractQueryImpl.uniqueElement(AbstractQueryImpl.java:844)
at org.hibernate.impl.AbstractQueryImpl.uniqueResult(AbstractQueryImpl.java:835)
at org.jbpm.pvm.internal.hibernate.DbSessionImpl.findTaskByExecution(DbSessionImpl.java:382)
at org.jbpm.jpdl.internal.activity.MailListener.notify(MailListener.java:50)
at org.jbpm.pvm.internal.model.op.ExecuteEventListener.perform(ExecuteEventListener.java:81)
at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:637)
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_4.performAtomicOperationSync(ExecutionImpl_$$_javassist_4.java)
at org.jbpm.pvm.internal.model.op.ExecuteActivityMessage.execute(ExecuteActivityMessage.java:46)
at org.jbpm.pvm.internal.cmd.ExecuteJobCmd.execute(ExecuteJobCmd.java:74)
at org.jbpm.pvm.internal.cmd.ExecuteJobCmd.execute(ExecuteJobCmd.java:41)
at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
at org.jbpm.pvm.internal.spring.CommandTransactionCallback.doInTransaction(CommandTransactionCallback.java:50)
at org.springframework.transaction.support.TransactionTemplate.execute(TransactionTemplate.java:128)
at org.jbpm.pvm.internal.tx.SpringTransactionInterceptor.execute(SpringTransactionInterceptor.java:79)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:54)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at org.jbpm.pvm.internal.jobexecutor.JobExecutorThread.run(JobExecutorThread.java:63)
I believe org.jbpm.jpdl.internal.activity.TaskActivity.execute() method should be modified to try to look up the task instance first and create a new instance only if there is no existing one in the database:
public void execute(ExecutionImpl execution) {
DbSession dbSession = Environment.getFromCurrent(DbSession.class);
TaskImpl task = dbSession.findTaskByExecution(execution);
if(task == null) {
task = (TaskImpl) dbSession.createTask();
task.setTaskDefinition(taskDefinition);
task.setExecution(execution);
...
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[JBoss JIRA] Created: (JBPM-2650) nested Forks
by Sebastian Castellanos (JIRA)
nested Forks
------------
Key: JBPM-2650
URL: https://jira.jboss.org/jira/browse/JBPM-2650
Project: jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: jBPM 4.2
Reporter: Sebastian Castellanos
Priority: Critical
Hi,
I have a situation where you have two nested fork, at the first fork left a task unfinished and launched the second fork with two more tasks, but when it launches the second fork, I repeat one of the tasks of the second Fork.
it means if the second Fork is associated with(Task 1, Task 2), when executed, throws (Task 1, Task 2, Task 1).
The second fork should not only launch their two tasks?, By repeating one of them?. this is normal operation with two nested Fork?.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[JBoss JIRA] Created: (JBPM-2879) lookupJeeTransactionManager() method in org.jbpm.pvm.internal.tx.JtaTransaction class has problem if used in Tomcat with JOTM
by Jayanta Sarkar (JIRA)
lookupJeeTransactionManager() method in org.jbpm.pvm.internal.tx.JtaTransaction class has problem if used in Tomcat with JOTM
-----------------------------------------------------------------------------------------------------------------------------
Key: JBPM-2879
URL: https://jira.jboss.org/browse/JBPM-2879
Project: jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: jBPM 4.3
Environment: jBPM4.3, apache-tomcat-6.0.14, jdk1.6.0_11, MySQL
Reporter: Jayanta Sarkar
Priority: Critical
The lookupJeeTransactionManager() method in org.jbpm.pvm.internal.tx.JtaTransaction class cannot obtain TransactionManager through JNDI look up in Tomcat with JOTM. The reason is there is no separate TransactionManager implementation in JOTM. The class which provides the implementation for UserTransaction is org.objectweb.jotm.Current.java internally implements javax.transaction.TransactionManager. So if we add some code in the lookupJeeTransactionManager() method as below this works:
if (transactionManager == null)
{
UserTransaction ut = (UserTransaction) lookupFromJndi(userTransactionJndiName);
if (ut instanceof TransactionManager)
{
System.out.println("lookupJeeTransaction:: found TransactionManager");
transactionManager = ((TransactionManager) ut);
}
}
We need to modify this code such a way so that it works in all server with all JTA implementation. I am in the process of making some patch for this and will send that.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[JBoss JIRA] Created: (JBPM-2829) A newline in a decision expression break the scripting engine
by Sebastian Rühl (JIRA)
A newline in a decision expression break the scripting engine
-------------------------------------------------------------
Key: JBPM-2829
URL: https://jira.jboss.org/jira/browse/JBPM-2829
Project: jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Runtime Engine
Reporter: Sebastian Rühl
Attachments: jbpm-test-db-NewLineConditionExpressionTest.patch
If you put a new line in a decision expression like:
<conditionExpression xsi:type="tFormalExpression">${bewertungen>2}
</conditionExpression>
instead of:
<conditionExpression xsi:type="tFormalExpression">${bewertungen>2}</conditionExpression>
the scripting engine will fail with a error:
org.jbpm.api.JbpmException: Expression '${bewertungen>2}
' did not resolve to a boolean value
at org.jbpm.bpmn.model.SequenceflowCondition.evaluate(SequenceflowCondition.java:55)
at org.jbpm.bpmn.flownodes.BpmnActivity.findOutgoingSequenceFlow(BpmnActivity.java:134)
at org.jbpm.bpmn.flownodes.ExclusiveGatewayActivity.execute(ExclusiveGatewayActivity.java:53)
at org.jbpm.bpmn.flownodes.ExclusiveGatewayActivity.execute(ExclusiveGatewayActivity.java:43)
at org.jbpm.pvm.internal.model.op.ExecuteActivity.perform(ExecuteActivity.java:60)
at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperationSync(ExecutionImpl.java:657)
at org.jbpm.pvm.internal.model.ExecutionImpl.performAtomicOperation(ExecutionImpl.java:617)
at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:418)
at org.jbpm.pvm.internal.model.ExecutionImpl.signal(ExecutionImpl.java:404)
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:585)
at org.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:197)
at org.jbpm.pvm.internal.model.ExecutionImpl_$$_javassist_32.signal(ExecutionImpl_$$_javassist_32.java)
at org.jbpm.pvm.internal.task.TaskImpl.complete(TaskImpl.java:199)
at org.jbpm.pvm.internal.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:65)
at org.jbpm.pvm.internal.cmd.CompleteTaskCmd.execute(CompleteTaskCmd.java:32)
at org.jbpm.pvm.internal.cmd.CompositeCmd.execute(CompositeCmd.java:43)
at org.jbpm.pvm.internal.cmd.CompositeCmd.execute(CompositeCmd.java:35)
at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
at org.jbpm.pvm.internal.tx.StandardTransactionInterceptor.execute(StandardTransactionInterceptor.java:54)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.executeInNewEnvironment(EnvironmentInterceptor.java:53)
at org.jbpm.pvm.internal.svc.EnvironmentInterceptor.execute(EnvironmentInterceptor.java:40)
at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
at org.jbpm.pvm.internal.svc.SkipInterceptor.execute(SkipInterceptor.java:43)
at org.jbpm.pvm.internal.svc.TaskServiceImpl.completeTask(TaskServiceImpl.java:105)
at org.jbpm.pvm.internal.svc.TaskServiceImpl.completeTask(TaskServiceImpl.java:92)
at org.jbpm.bpmn.NewLineConditionExpressionTest.testNormalExecuteDecisionCondition(NewLineConditionExpressionTest.java:47)
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:585)
at junit.framework.TestCase.runTest(TestCase.java:164)
at org.jbpm.test.BaseJbpmTestCase.runTest(BaseJbpmTestCase.java:87)
at junit.framework.TestCase.runBare(TestCase.java:130)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:230)
at junit.framework.TestSuite.run(TestSuite.java:225)
at org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)
In fact there is a error in jbpm cause the scripting engine will evaluate right but instead of returning true it will return "true" in this case...
see appended patch with contains a patch with a test
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months
[JBoss JIRA] Created: (JBPM-2583) IdentityService createGroup creates duplicate groups
by Robert Moskal (JIRA)
IdentityService createGroup creates duplicate groups
----------------------------------------------------
Key: JBPM-2583
URL: https://jira.jboss.org/jira/browse/JBPM-2583
Project: jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Components: Runtime Engine
Affects Versions: jBPM 4.1
Environment: JDK 1.6, mysql 5
Reporter: Robert Moskal
Repeatedly calling createGroup with the same group name causes very similar records to be entered into the JBPM_ID_GROUP table. They differ only bythe DBID_ field value. Here is an example of what I found in the database.
17 0 another another (null) (null)
18 0 another another (null) (null)
19 0 another another (null) (null)
20 0 another another (null) (null)
21 0 another another (null) (null)
Retrievals don't result in duplicates, but this seems like it might cause problems.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://jira.jboss.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira
14 years, 5 months