jenkinsci / jenkinsci/workflow-cps-plugin
[JENKINS-72830] InterruptedException during initial checkout leads to FAILURE instead of ABORT
- Dominant language
- Java
- Stars
- 186
- Forks
- 213
- Avg merge
- 12h 12m
- Merged PRs (30d)
- 8
Description
An aborted build should have the status ABORTED. The status is FAILURE if the build gets aborted during the initial checkout. An interrupted exception should be handled gracefully and lead to ABORTED (also no repeats of the checkout should be triggered).
I came across this issue while working on JENKINS-72819. Here the InterruptedException is causing a NPE in the exception handler in the git-client-plugin. After fixing this issue I now get the following call stack in case of an early abort. The last line is saying FAILURE which should be ABORTED.
ERROR: Checkout failed
java.lang.InterruptedException
at java.base/java.lang.Object.wait(Native Method)
at java.base/java.lang.Object.wait(Unknown Source)
at java.base/java.lang.ProcessImpl.waitFor(Unknown Source)
at hudson.Proc$LocalProc.join(Proc.java:328)
at hudson.Proc.joinWithTimeout(Proc.java:172)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2839)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2185)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:871)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1222)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:165)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:71)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
ERROR: Maximum checkout retry attempts reached, aborting
Finished: FAILURE
---
Originally reported by ckullabosch, imported from: InterruptedException during initial checkout leads to FAILURE instead of ABORT
Raw content of original issue
An aborted build should have the status ABORTED. The status is FAILURE if the build gets aborted during the initial checkout. An interrupted exception should be handled gracefully and lead to ABORTED (also no repeats of the checkout should be triggered).
I came across this issue while working on
JENKINS-72819. Here the InterruptedException is causing a NPE in the exception handler in the git-client-plugin. After fixing this issue I now get the following call stack in case of an early abort. The last line is saying FAILURE which should be ABORTED.
ERROR: Checkout failed
java.lang.InterruptedException
at java.base/java.lang.Object.wait(Native Method)
at java.base/java.lang.Object.wait(Unknown Source)
at java.base/java.lang.ProcessImpl.waitFor(Unknown Source)
at hudson.Proc$LocalProc.join(Proc.java:328)
at hudson.Proc.joinWithTimeout(Proc.java:172)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2839)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2185)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:635)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$2.execute(CliGitAPIImpl.java:871)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1222)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1305)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:165)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:71)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
ERROR: Maximum checkout retry attempts reached, aborting
Finished: FAILURE
Contributor guide
Research direction
Start at CpsScmFlowDefinition.create and follow the checkout path through SCMStep.checkout and WorkflowRun.run, using the reported InterruptedException stack as the reproduction guide. Reproduce an abort during initial checkout and verify that the build finishes as ABORTED without retrying checkout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, java
- Domain
- ci-cd
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100