Skip to main content

How can I troubleshoot "execution expired" errors when running a job on a Runner?

"Execution expired" errors in GitLab Runner can occur when a job takes longer than the configured timeout to complete. The default timeout is 3600 seconds (1 hour), but this can be customized in the runner configuration. Here are some steps you can take to troubleshoot and fix this issue:

Step 1: Check Runner Configuration

The first step is to check the runner configuration for the configured timeout. Ensure that the configured timeout is sufficient for the job to complete. You can check the runner configuration in the runner configuration file (/etc/gitlab-runner/config.toml) using the following command:

sudo cat /etc/gitlab-runner/config.toml

Step 2: Check Pipeline Logs

If the runner configuration is correct, the next step is to check the logs of the pipeline. The logs can help you identify where the pipeline is failing and why. You can view the logs in the GitLab web interface by navigating to CI/CD > Pipelines and clicking on the pipeline you want to view. The logs will be displayed on the right-hand side of the screen.

Step 3: Check Resource Allocation

If the pipeline logs do not provide any insight, the issue may be related to resource allocation. Ensure that the runner and the machine where the pipeline is executing have sufficient resources, such as CPU, memory, and disk space.

Step 4: Check Network Connectivity

If the above steps do not resolve the issue, the issue may be related to network connectivity. Ensure that the runner and the machine where the pipeline is executing have network connectivity and can access the GitLab instance.

Step 5: Increase Timeout

If the configured timeout is too low for the job to complete, you can increase the timeout in the runner configuration. To increase the timeout, add the following line to the runner configuration file:

[[runners]]
timeout = 7200

In the above example, the timeout is increased to 7200 seconds (2 hours).

Summary

In conclusion, "execution expired" errors in GitLab Runner can be caused by timeout issues, runner configuration, pipeline logs, resource allocation issues, or network connectivity issues. By following the above steps, you can troubleshoot and fix the issue and ensure that your pipeline executes smoothly.