[JBoss JIRA] Created: (JBPM-2608) JobSession.findJobsWithOverdueLockTime returns incorrect list of overdue jobs for LockMonitorThread
by Martin Putz (JIRA)
JobSession.findJobsWithOverdueLockTime returns incorrect list of overdue jobs for LockMonitorThread
---------------------------------------------------------------------------------------------------
Key: JBPM-2608
URL: https://jira.jboss.org/jira/browse/JBPM-2608
Project: jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: jBPM 3.2.7, jBPM 3.2.8
Reporter: Martin Putz
Assignee: Alejandro Guizar
Fix For: jBPM 3.2.9
In org.jbpm.job.executor.LockMonitorThread#unlockOverdueJobs(), the list of overdue jobs to be unlocked is queried the following way:
Date threshold = new Date(System.currentTimeMillis() - maxLockTime - lockBufferTime);
List overdueJobs = jbpmContext.getJobSession().findJobsWithOverdueLockTime(threshold);
But the query is incorrect, as it returns all jobs where the lockTime is bigger than the threshold, which means that the job has been locked shorter than (maxLockTime + lockBufferTime):
<query name="JobSession.findJobsWithOverdueLockTime">
<![CDATA[
select job
from org.jbpm.job.Job as job
where job.lockTime > :threshold
]]>
</query>
As a result, the LockMonitorThread will set the lockTime and lockOwner to null, where the same Job instance is also updated by a JobExecutorThread, which will lead to a StaleObjectStateException:
ERROR [org.hibernate.event.def.AbstractFlushingEventListener] (JbpmJobExector:LockMonitorThread@169.1.1.1)
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.ExecuteActionJob#123]
The 'where' clause in the query needs to be reversed:
Index: modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml
===================================================================
--- modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml (revision 5825)
+++ modules/core/src/main/resources/org/jbpm/db/hibernate.queries.hbm.xml (working copy)
@@ -385,7 +385,7 @@
<![CDATA[
select job
from org.jbpm.job.Job as job
- where job.lockTime > :threshold
+ where job.lockTime < :threshold
]]>
</query>
--
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
15 years
[JBoss JIRA] Created: (JBPM-2639) Task with taskform and timer leads to NPE
by Joram Barrez (JIRA)
Task with taskform and timer leads to NPE
-----------------------------------------
Key: JBPM-2639
URL: https://jira.jboss.org/jira/browse/JBPM-2639
Project: jBPM
Issue Type: Bug
Security Level: Public (Everyone can see)
Affects Versions: jBPM 4.2
Reporter: Joram Barrez
Assignee: Joram Barrez
Fix For: jBPM 4.3
Code that throws NPE:
private InputStream loadCSS(String executionId)
{
RepositoryService repoService = processEngine.getRepositoryService();
ExecutionService execService = processEngine.getExecutionService();
ProcessInstance instance = execService.createProcessInstanceQuery()
.processInstanceId(executionId)
.uniqueResult();
ProcessDefinition definition = repoService.createProcessDefinitionQuery()
.processDefinitionId(instance.getProcessDefinitionId()).uniqueResult();
InputStream in = repoService.getResourceAsStream(definition.getDeploymentId(), PROCESSFORMS_CSS);
return in;
}
When a timer is defined on a task, a new execution is created. The procInst query will return null in that case (PARENT != null in HQL).
--
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
15 years