The handleException method in the AbstractAvailableJobsExecutor class [1] only logs a WARN message for the exception without throwing it.
Here is an example of logging and stacktrace:
2022-11-15 01:02:00,346 WARN [pool-7-thread-3] org.drools.persistence.PersistableRunner: Could not commit session
org.jbpm.workflow.instance.WorkflowRuntimeException: – null
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.processWorkItemHandler(WorkItemNodeInstance.java:170)
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.internalTrigger(WorkItemNodeInstance.java:141)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.trigger(NodeInstanceImpl.java:206)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:414)
at org.jbpm.workflow.instance.impl.NodeInstanceImpl.triggerNodeInstance(NodeInstanceImpl.java:392)
at org.jbpm.workflow.instance.node.AsyncEventNodeInstance.triggerCompleted(AsyncEventNodeInstance.java:122)
at org.jbpm.workflow.instance.node.AsyncEventNodeInstance$AsyncExternalEventListener.signalEvent(AsyncEventNodeInstance.java:137)
at org.jbpm.workflow.instance.impl.WorkflowProcessInstanceImpl.signalEvent(WorkflowProcessInstanceImpl.java:659)
at org.drools.core.command.runtime.process.SignalEventCommand.execute(SignalEventCommand.java:123)
at org.drools.core.command.runtime.process.SignalEventCommand.execute(SignalEventCommand.java:37)
at org.drools.core.fluent.impl.PseudoClockRunner.executeBatch(PseudoClockRunner.java:102)
at org.drools.core.fluent.impl.PseudoClockRunner.executeBatches(PseudoClockRunner.java:69)
at org.drools.core.fluent.impl.PseudoClockRunner.execute(PseudoClockRunner.java:61)
at org.drools.core.fluent.impl.PseudoClockRunner.execute(PseudoClockRunner.java:39)
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:39)
at org.drools.persistence.PersistableRunner$TransactionInterceptor.execute(PersistableRunner.java:608)
at org.drools.persistence.PersistableRunner$TransactionInterceptor.execute(PersistableRunner.java:568)
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:39)
at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.internalExecute(OptimisticLockRetryInterceptor.java:102)
at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:83)
at org.drools.persistence.jpa.OptimisticLockRetryInterceptor.execute(OptimisticLockRetryInterceptor.java:44)
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:39)
at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:73)
at org.drools.persistence.jta.TransactionLockInterceptor.execute(TransactionLockInterceptor.java:45)
at org.drools.core.command.impl.AbstractInterceptor.executeNext(AbstractInterceptor.java:39)
at org.jbpm.runtime.manager.impl.error.ExecutionErrorHandlerInterceptor.internalExecute(ExecutionErrorHandlerInterceptor.java:66)
at org.jbpm.runtime.manager.impl.error.ExecutionErrorHandlerInterceptor.execute(ExecutionErrorHandlerInterceptor.java:52)
at org.jbpm.runtime.manager.impl.error.ExecutionErrorHandlerInterceptor.execute(ExecutionErrorHandlerInterceptor.java:29)
at org.drools.persistence.PersistableRunner.execute(PersistableRunner.java:400)
at org.drools.persistence.PersistableRunner.execute(PersistableRunner.java:68)
at org.drools.core.runtime.InternalLocalRunner.execute(InternalLocalRunner.java:37)
at org.drools.core.runtime.InternalLocalRunner.execute(InternalLocalRunner.java:41)
at org.drools.core.command.impl.CommandBasedStatefulKnowledgeSession.signalEvent(CommandBasedStatefulKnowledgeSession.java:255)
at org.jbpm.process.core.async.AsyncSignalEventCommand.execute(AsyncSignalEventCommand.java:53)
at org.jbpm.executor.impl.AbstractAvailableJobsExecutor.executeGivenJob(AbstractAvailableJobsExecutor.java:135)
at org.jbpm.executor.impl.AvailableJobsExecutor.executeJob(AvailableJobsExecutor.java:33)
at org.jbpm.executor.impl.concurrent.PrioritisedRunnable.run(PrioritisedRunnable.java:47)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at org.jbpm.executor.impl.concurrent.PrioritisedScheduledFutureTask.run(PrioritisedScheduledFutureTask.java:41)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: java.lang.NullPointerException: null
at myown.custom.RESTWorkItemHandler.executeWorkItem(RESTWorkItemHandler.java:422)
at org.drools.persistence.jpa.processinstance.JPAWorkItemManager.internalExecuteWorkItem(JPAWorkItemManager.java:69)
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.lambda$internalTrigger$0(WorkItemNodeInstance.java:141)
at org.jbpm.workflow.instance.node.WorkItemNodeInstance.processWorkItemHandler(WorkItemNodeInstance.java:155)
... 44 common frames omitted
This ends up with a transaction timeout:
2022-11-15 01:03:00,548 WARN [Transaction Reaper Worker 0] com.arjuna.ats.arjuna: ARJUNA012381: Action id 0:ffff0a660760:941d:6372e4b1:291 completed with multiple threads - thread pool-7-thread-3 was in progress with sun.misc.Unsafe.park(Native Method)
Can we review the code to make sure the exception is properly handled?