Job FAQ

Updated at:

This topic describes how to resolve common job management issues in SchedulerX.

What do I do if a Spring application cannot find a bean?

  1. In Application Management, connect to the machine and check the startup method. Ensure that the startup method is set to Spring or Spring Boot.
  2. JobProcessor as a bean. For example, you can add the @Component annotation.
  3. Check the POM dependencies. If spring-boot-devtools is a dependency, exclude it.
  4. If the JobProcessor and process methods have Aspect-Oriented Programming (AOP) annotations, upgrade the SchedulerX client to the latest version. Older versions do not support AOP.
  5. An extra proxy layer can cause a bean type mismatch. To troubleshoot this, set a breakpoint in the DefaultListableBeanFactory class. The beanDefinitionNames member variable contains a list of beans registered by Spring. In this list, you can check if a bean is proxied by an aspect. This issue can occur if you indirectly import an incorrect third-party library. You can exclude the library to resolve the issue.
1

If these solutions do not work, you can debug the `ThreadContainer.start` method. If `class.forName` reports an error but the class exists, a framework that you are using might be causing a classLoader mismatch. You can resolve this issue by setting SchedulerxWorker.setClassLoader.

Job fails with the "submit jobInstanceId to worker timeout" error

If this error occurs during application release or only occasionally, no action is required.

If the error persists and the `workerAddr` in the error message is always the same machine, the persistent connection between the server and the client is disconnected. You can restart the worker node or upgrade the SchedulerX client to the latest version. After you upgrade, the disconnected persistent connection automatically recovers.

Task fails with the error "used space beyond 90.0%!"

This error indicates that the disk is full. You can clear the disk space on the ECS instance or container.

Job fails with ClassNotFoundException

This error indicates that the class does not exist on the worker that is running the job. Make sure that the Processor class name configured for the Java job is the full path of the class, not an abbreviation.

1

If the configured `jobProcessor` class name is correct, the class does not exist on the worker. This issue usually occurs because you deployed the wrong package or the application is connected to another user's machine. You can log on to the worker machine and decompile the code to view the details.

Job failed with the error "jobInstance=xxx don't update progress more than 60s"

If a worker that is running a job stops working or is being released and does not report its progress for more than 60 seconds, the server forcibly terminates it. If you confirm that the issue is caused by the worker or that the worker no longer exists, no action is required.

Task execution fails without an error message

Symptoms:

A job fails to run, and no error message is returned.

Possible causes:

The machine has failed or the business logic failed to run.

Solutions:

  • On the Execution List page, click Task Instance Details to view the sub-task details and find the machine where the execution failed.

    If no sub-task details are available, it is a simple job. Check the `workAddr` in the basic information. This is the business machine that executes the job.

  • Log on to the business machine and open the ~/logs/schedulerx/worker.log file.

    You can run grep <instance ID> worker.log to view logs related to the instance. If an ERROR-level exception exists, check the stack for the specific cause.

  • If the error description is empty, the business logic likely failed to execute and did not return an error message. You should troubleshoot your business logic first.
  • If the error description contains a framework exception, join the DingTalk group (ID: 23103656) and contact SchedulerX technical support.

How do I find the cause of a job failure?

  • If a standalone task's business logic throws an exception, you can view the error message by navigating to the Execution List page, clicking Task Instance List, and then clicking Details in the Actions column for the corresponding task instance.
  • If the job does not throw an exception or you use a distributed job, you can use Simple Log Service to troubleshoot the issue for your Professional Edition application.
  • For a Basic Edition application, you can log on to the worker node and check the SchedulerX logs and your business logs for troubleshooting.

What do I do if a job gets stuck while running?

Symptoms:

The scheduled job remains in the running state and does not end.

Possible causes:

  • A business logic issue.
  • A SchedulerX issue.

Solutions:

To troubleshoot business logic issues, use the following solutions. For other issues, you can join the DingTalk group (ID: 23103656) and contact SchedulerX technical support.

  • For Professional Edition applications, you can use the View Stack feature in the console (available for client versions 1.4.2 and later) to troubleshoot an abnormal job.
  • Basic Edition application: You can log on to the stuck worker node and run the jstack command to view the stack.
    jstack <pid> | grep <task instance id> -A 20
    6

How do I troubleshoot slow job execution?

You can upgrade to the Professional Edition and use Tracing Analysis. For more information, see How to integrate Tracing Analysis.

What do I do if the number of running job instances reaches the limit?

Symptoms:

On the Job Management page, when you click Run Once, the system displays the The number of running job instances has reached the upper limit. Please try again later. message.

Possible causes:

  • A task instance for this job is already running.
  • The number of running task instances has reached the maximum concurrency configured for the job.

Solutions:

If the concurrency is reasonable, no action is required. On the Job Management page, click More > History to view the running task instances.

If the concurrency setting is not appropriate, find the target job, click Edit in the Operation column, and set Instance Concurrency in the advanced configuration.

If a job did not finish its last run, is the next run queued or skipped?

The default concurrency for a job is 1, which means that the job runs serially. If a job takes a long time to run and the previous run is not finished when the next scheduled time arrives, the next run is discarded. It is not executed or queued.

If you set the instance concurrency to 2 and the previous run is not finished, another instance can still run when the next scheduled time arrives. A maximum of two task instances can run at the same time.

How do I set up a one-time job?

SchedulerX 2.0 supports one-time jobs. You can set the time type to `one_time`. Execution records are not kept for one-time jobs.

How do I view the history of a one-time job after it runs?

After a one-time job runs, it is automatically destroyed to prevent data accumulation. No historical records are kept. To save historical records, you can enable Simple Log Service to retain the execution logs of all jobs from the last two weeks for troubleshooting. For more information about how to enable Simple Log Service, see Application Management.

How do I schedule jobs at the second level?

SchedulerX supports second-level scheduling. The `cron` and `fix_rate` time types do not support second-level scheduling. You can select the `second_delay` time type, which runs the job a few seconds after the previous run is complete.

What do I do if a job is not scheduled at a specific time?

If a standalone job is not scheduled at a specific time, check whether machines exist in the machine list and whether all machines are busy. If no machines are available, troubleshoot the "no worker available" issue. If all machines are busy, troubleshoot the "all workers are busy" issue. For more information, see No worker available and What do I do if all workers are busy?.

You can configure an alarm for "no worker available" for the job. For more information, see Job management.

How do I set a timeout period in SchedulerX?

SchedulerX supports setting a timeout for an entire job, but not for sub-tasks. You can dynamically modify the timeout period in the console. For more information, see Job management.

Why does a job continue to run after its instance is stopped?

Symptoms:

The job continues to run after its instance is stopped.

Possible cause:

After a task instance is stopped, SchedulerX sends a Kill message to the client. After the client receives the Kill message, it stops dispatching and running unexecuted sub-tasks and destroys the instance's context and all its thread pools. However, sub-tasks that are already running are not stopped. Only their corresponding threads are interrupted. Therefore, the sub-tasks continue to run until they are finished.

Solutions:

  • In most cases, no action is required. You can wait for the sub-tasks to finish.
  • To immediately end all running tasks after stopping the instance, you can modify the sub-task processing logic to handle the current thread's Interrupt state.

How do I use advanced job management configurations?

For more information, see Advanced configuration parameters for job management.

What do I do if all workers are busy?

On the Application Management page, locate the busy worker. Then, click Busy to view the metrics that exceed the threshold.

1

You can configure the busy threshold on the Application Management page by clicking Edit Application Group.

1

If a worker is busy because of a high load, check if your application is deployed in a container, such as Kubernetes. If it is, you must configure the following two parameters. Otherwise, the collected CPU utilization might be inaccurate. For more information, see Connect a Spring Boot application to SchedulerX.

Key Description Set Value Initial version
spring.schedulerx2.enableCgroupMetrics Specifies whether to use control groups (cgroups) to collect the metrics of the client instance. You must manually enable this feature in a container (Kubernetes) environment. true/false. The default value is false. 1.2.2.2
spring.schedulerx2.cgroupPathPrefix The cgroup path in the container. The default path is /sys/fs/cgroup/cpu/. If this path exists, you do not need to set this parameter. 1.2.2.2

How do I integrate Tracing Analysis?

Job scheduling supports end-to-end tracing. For more information, see How to integrate Tracing Analysis.

A job gets stuck or slows down during application release

Symptoms

A job hangs or slows down during an application release.

Possible causes

For a distributed job, if a machine processing sub-tasks goes offline, the sub-tasks are redistributed. The system also polls to check the online status of the machines, which slows down the entire process.

Solution:

You can upgrade the client to the latest version. This issue is optimized in versions 1.7.9 and later.

What do I do if the system prompts me to enter instance parameters after I click Run Once?

On the Job Management page, click Run Once in the Operation column to run the scheduled job once. The Instance Parameters field in the dialog box is optional and is mainly used for testing.

1

If I click Run Once and enter instance parameters, does the code get the instance parameters or the job parameters?

Instance parameters and job parameters are different concepts. The specific parameters retrieved by the code are determined by your business code.

How do I get job parameters or instance parameters?

The code is as follows.

@Component
public class JavaDemoProcessor extends JavaProcessor {


    private static final Logger LOGGER = LoggerFactory.getLogger("schedulerxLog");


    @Override
    public ProcessResult process(JobContext jobContext) throws InterruptedException {

        LOGGER.info(JSON.toJSONString(jobContext));
        // Get the job parameters.
        String jobParameters = jobContext.getJobParameters();
        // Get the instance parameters.
        String instanceParameters = jobContext.getInstanceParameters();
        LOGGER.info("Job parameters: " + jobParameters);
        LOGGER.info("Instance parameters: " + instanceParameters);
        return new ProcessResult(InstanceStatus.SUCCESS);
    }

}

How do I make the code get the instance parameters by default if they are entered, and get the job parameters if they are not?

The following is the code.

@Component
public class JavaDemoProcessor extends JavaProcessor {

    private static final Logger LOGGER = LoggerFactory.getLogger("schedulerxLog");

    @Override
    public ProcessResult process(JobContext jobContext) throws InterruptedException {
        String params = null;
        if (StringUtils.isNotBlank(jobContext.getInstanceParameters())) {
            params = jobContext.getInstanceParameters();
        } else {
            params = jobContext.getJobParameters();
        }
        LOGGER.info("JavaDemoProcessor params:{}", params);
        return new ProcessResult(InstanceStatus.SUCCESS);
    }

}