After a period of timer execution, job suddenly stops running in a cluster environment

We are developing a Data Center Jira App with scheduled jobs.

After running the job normally in a cluster environment (4 nodes) for a period of time, the job suddenly stops running, and no error logs output.

Disable app and then enable (unschedule job and schedule it again), job can run normally again for a period of time.

The onPluginEnabled() method code in our app is as follows:

AutoCleanUserBean bean = autoCleanUserService.select(); 
if (bean != null && Boolean.TRUE.equals(bean.getIsEnabled())) {
    String cron = DateHelper.getCronByDay(bean.getIntervalDays(), bean.getJobTime());
    Set<JobRunnerKey> registeredJobRunnerKeys = schedulerService.getRegisteredJobRunnerKeys();
    Set<JobRunnerKey> filterSHDSDJobSet = registeredJobRunnerKeys.stream()
          .filter(jobRunnerKeySet -> 
          jobRunnerKeySet.toString().equals(JOB_RUNNER_KEY.toString())).collect(Collectors.toSet());
      if (filterSHDSDJobSet.size() == 0) {
          schedulerService.registerJobRunner(JOB_RUNNER_KEY, this);
      }
      final JobConfig jobConfig =
          JobConfig.forJobRunnerKey(JOB_RUNNER_KEY)
                  .withRunMode(RunMode.RUN_ONCE_PER_CLUSTER)
                  .withSchedule(Schedule.forCronExpression(cron));
      try {
          JobDetails jobDetails = schedulerService.getJobDetails(JOB_ID);
          if(jobDetails!=null){
              log.info("scheduler job old jobDetails!!!!!!!+"+jobDetails.toString());
              schedulerService.unscheduleJob(JOB_ID);
              schedulerService.scheduleJob(JOB_ID, jobConfig);
          }else{
              schedulerService.scheduleJob(JOB_ID, jobConfig);
          }
          JobDetails jobDetails1 = schedulerService.getJobDetails(JOB_ID);
          if(jobDetails1 != null ){
              log.warn("scheduler job jobDetails!!!!!!!+"+jobDetails1.toString());
          }else{
              log.warn("scheduler job jobDetails1 no found!!!!!!!");
          }
      } catch (SchedulerServiceException e) {
          log.error("scheduler job failed!!!!!!!:");
      }
}
1 Like