Skip to content

Commit

Permalink
Fix executions hangs on finalisation exception (#5070)
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Di Tommaso <[email protected]>
  • Loading branch information
pditommaso committed Jul 9, 2024
1 parent e6a5e17 commit 4c207c2
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -663,14 +663,24 @@ class TaskPollingMonitor implements TaskMonitor {

// finalize the task asynchronously
if( enableAsyncFinalizer ) {
finalizerPool.submit( ()-> finalizeTask(handler) )
finalizerPool.submit( ()-> safeFinalizeTask(handler) )
}
else {
finalizeTask(handler)
}
}
}

protected void safeFinalizeTask(TaskHandler handler) {
try {
finalizeTask(handler)
}
catch (Throwable t) {
log.error "Unexpected error while finalizing task '${handler.task.name}' - cause: ${t.message}"
session.abort(t)
}
}

protected void finalizeTask( TaskHandler handler ) {
// finalize the task execution
final fault = handler.task.processor.finalizeTask(handler.task)
Expand Down

0 comments on commit 4c207c2

Please sign in to comment.