Uploaded image for project: 'jBPM'
  1. jBPM
  2. JBPM-2886

job is not released when the transaction is marked as rollback only

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • jBPM 4.4
    • jBPM 4.3
    • Runtime Engine
    • None

      Job is not released when the exception occurred during job execution and transaction is marked as rollback only because synchronization cannot be registered in transaction (according to javax.transaction.Transaction#registerSynchronization java doc: @exception RollbackException Thrown to indicate that the transaction has been marked for rollback only).
      Following exception is thrown:
      org.jbpm.api.JbpmException: couldn't register synchronization: test1
      at org.jbpm.pvm.internal.tx.JtaTransaction.registerSynchronization(JtaTransaction.java:78)
      at org.jbpm.pvm.internal.cmd.ExecuteJobCmd.handleJobExecutionException(ExecuteJobCmd.java:111)
      at org.jbpm.pvm.internal.cmd.ExecuteJobCmd.execute(ExecuteJobCmd.java:92)
      at org.jbpm.pvm.internal.cmd.ExecuteJobCmd.execute(ExecuteJobCmd.java:42)
      at org.jbpm.pvm.internal.svc.DefaultCommandService.execute(DefaultCommandService.java:42)
      at org.jbpm.pvm.internal.tx.JtaTransactionInterceptor.executeInNewTx(JtaTransactionInterceptor.java:87)
      at org.jbpm.pvm.internal.tx.JtaTransactionInterceptor.execute(JtaTransactionInterceptor.java:66)
      at org.jbpm.pvm.internal.svc.RetryInterceptor.execute(RetryInterceptor.java:55)
      at org.jbpm.pvm.internal.tx.JtaRetryInterceptor.executeWithRetry(JtaRetryInterceptor.java:52)
      at org.jbpm.pvm.internal.tx.JtaRetryInterceptor.execute(JtaRetryInterceptor.java:45)
      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.SkipInterceptor.execute(SkipInterceptor.java:43)
      at org.jbpm.pvm.internal.jobexecutor.JobParcel.run(JobParcel.java:48)
      at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
      at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
      at java.util.concurrent.FutureTask.run(FutureTask.java:138)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:619)

      After that, job could be acquired again but only after the lockMillis (default 30 minutes).
      IMO in such case the job has to be released because it delay job execution. To achieve it JobExceptionHandler (with small modification) has to be register before invoking job.execute(...) in org.jbpm.pvm.internal.cmd.ExecuteJobCmd:76. Exception could be passed to the handler in the catch block.

            rebody HuiSheng Xu (Inactive)
            adam.laczynski Adam Laczynski (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: