Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-6232

NPE in FailedJobListener if Job doesn't exist

    XMLWordPrintable

    Details

      Description

      What are the steps to reproduce your problem?
      Execute FailedJobListener with a Job ID which doesn't exist.

      What is the problem?
      Executing of the ExecuteJobsCmd and deleting a Job in parallel with working on a Job.
      If the Job was deleted the job transaction rollback and the FailedJoblistener will be called, in the ExecuteJobsCmd.
      Since the job is deleted the jobId references to no existing job. In the current version of the FailedjobListener the jobId is used to get the Job from the database.

      What would be the expected behavior:
      If the job doesn't exist the FailedJobListener does nothing.

      Hints (optional):
      Add not null check to the execution method:

      commandExecutor.execute(new Command<Void>() {
      
          public Void execute(CommandContext commandContext) {
              
              JobEntity job = commandContext
                .getJobManager()
                .findJobById(jobId);
              
              if (job == null) {
                //LOG job doesn't exist
                return null;
              }
              
              fireHistoricJobFailedEvt(jobId);
              cmd.execute(commandContext);
              return null;
            }
      });
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              thorben.lindhauer Thorben Lindhauer
              Reporter:
              christopher.zell Christopher Zell
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: