Buggy code:
public class Executor implements Runnable { private static final Logger LOG = LoggerFactory . getLogger ( Executor . class ) ; @ Autowired private ApplicationEventPublisher eventPublisher ; @ Autowired private BeanFactory beanFactory ; @ Autowired private PipelineFacade pipelineFacade ; @ Autowired private LogFacade logFacade ; @ Autowired ( required = false ) private List < PreExecutor > preExecutors ; @ Autowired ( required = false ) private List < PostExecutor > postExecutors ; @ Autowired private SqlAppender logAppender ; private PipelineExecution execution ; private Map < Node , Context > contexts = new HashMap < > ( ) ; private Date lastSuccessfulExTime ; @ PostConstruct public void init ( ) { } public void bind ( PipelineExecution execution ) { } private boolean executePreExecutors ( DependencyGraph graph ) { } private boolean executePostExecutors ( DependencyGraph graph ) { } private void executionFailed ( ) { } private void executionCancelled ( ) { } private void executionSuccessful ( ) { } private DependencyGraph prepareDependencyGraph ( ) { } private void execute ( ) { DependencyGraph dependencyGraph = prepareDependencyGraph ( ) ; ExecutionResult execResult = new ExecutionResult ( ) ; if ( ! ( executePreExecutors ( dependencyGraph ) ) ) { execResult . failure ( ) ; } boolean userAbortRequest = false ; for ( Node node : dependencyGraph ) { if ( ( ! ( execResult . continueExecution ( ) ) ) || userAbortRequest ) { break ; } MDC . put ( MDC_DPU_INSTANCE_KEY_NAME , Long . toString ( node . getDpuInstance ( ) . getId ( ) ) ) ; DPUExecutor dpuExecutor = beanFactory . getBean ( DPUExecutor . class ) ; try { dpuExecutor . bind ( node , contexts , execution , lastSuccessfulExTime ) ; } catch ( ContextException e ) { eventPublisher . publishEvent ( PipelineFailedEvent . create ( e , node . getDpuInstance ( ) , execution , this ) ) ; execResult . failure ( ) ; break ; } Executor . LOG . info ( "Starting<seq2seq4repair_space>execution<seq2seq4repair_space>of<seq2seq4repair_space>dpu<seq2seq4repair_space>{}<seq2seq4repair_space>=<seq2seq4repair_space>{}" , node . getDpuInstance ( ) . getId ( ) , node . getDpuInstance ( ) . getName ( ) ) ; final String threadName = "dpu:<seq2seq4repair_space>" + ( node . getDpuInstance ( ) . getName ( ) ) ; Thread executorThread = new Thread ( dpuExecutor , threadName ) ; executorThread . start ( ) ; while ( executorThread . isAlive ( ) ) { try { executorThread . join ( 5000 ) ; } catch ( InterruptedException e ) { stopExecution ( executorThread , dpuExecutor ) ; execResult . stop ( ) ; break ; } PipelineExecution uptodateExecution = pipelineFacade . getExecution ( execution . getId ( ) ) ; if ( uptodateExecution == null ) { Executor . LOG . warn ( "Seems<seq2seq4repair_space>like<seq2seq4repair_space>someone<seq2seq4repair_space>deleted<seq2seq4repair_space>our<seq2seq4repair_space>execution." ) ; stopExecution ( executorThread , dpuExecutor ) ; execResult . stop ( ) ; break ; } else if ( uptodateExecution . getStop ( ) ) { eventPublisher . publishEvent ( new cz . cuni . mff . xrg . odcs . backend . pipeline . event . PipelineAbortedEvent ( execution , this ) ) ; stopExecution ( executorThread , dpuExecutor ) ; execution . setStatus ( CANCELLING ) ; execResult . stop ( ) ; userAbortRequest = true ; break ; } } ExecutionResult dpuResults = dpuExecutor . getExecResult ( ) ; if ( dpuResults . executionEndsProperly ( ) ) { } else { dpuResults . failure ( ) ; <START_BUG> eventPublisher . publishEvent ( PipelineFailedEvent . create ( "DPU<seq2seq4repair_space>execution<seq2seq4repair_space>failed" , "The<seq2seq4repair_space>DPU<seq2seq4repair_space>execution<seq2seq4repair_space>thread<seq2seq4repair_space>ends<seq2seq4repair_space>in<seq2seq4repair_space>non-standart<seq2seq4repair_space>way" , node . getDpuInstance ( ) , execution , this ) ) ; <END_BUG> } execResult . add ( dpuResults ) ; } if ( ! ( executePostExecutors ( dependencyGraph ) ) ) { execResult . failure ( ) ; } try { logAppender . flush ( ) ; } catch ( Throwable e ) { Executor . LOG . error ( "logAppender.flush()<seq2seq4repair_space>throws!!!" , e ) ; } if ( userAbortRequest ) { executionCancelled ( ) ; } else { if ( execResult . executionEndsSuccessfully ( ) ) { executionSuccessful ( ) ; } else { executionFailed ( ) ; } } } @ Override public void run ( ) { } private void stopExecution ( Thread executorThread , DPUExecutor dpuExecutor ) { } }

Fix:
eventPublisher . publishEvent ( PipelineFailedEvent . create ( "DPU<seq2seq4repair_space>execution<seq2seq4repair_space>failed" , "The<seq2seq4repair_space>DPU<seq2seq4repair_space>execution<seq2seq4repair_space>thread<seq2seq4repair_space>ends<seq2seq4repair_space>in<seq2seq4repair_space>non-standard<seq2seq4repair_space>way" , node . getDpuInstance ( ) , execution , this ) ) ;