Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Diagnosis for NoSuchElementException from ForkScanner.setHeads #246

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

jglick
Copy link
Member

@jglick jglick commented Aug 8, 2022

A pipeline (unified-release for @cloudbees employees) had a function like

void skipStage(def stage) {
    println "Skip stage ${stage}"
    org.jenkinsci.plugins.pipeline.modeldefinition.Utils.markStageSkippedForConditional(stage)
}

which I observed to throw an error on one occasion (no idea if reproducible)

java.util.NoSuchElementException
	at java.base/java.util.ArrayDeque.removeFirst(ArrayDeque.java:363)
	at java.base/java.util.ArrayDeque.pop(ArrayDeque.java:594)
	at org.jenkinsci.plugins.workflow.graphanalysis.ForkScanner.setHeads(ForkScanner.java:456)
	at org.jenkinsci.plugins.workflow.graphanalysis.AbstractFlowScanner.setup(AbstractFlowScanner.java:140)
	at org.jenkinsci.plugins.workflow.graphanalysis.AbstractFlowScanner.findFirstMatch(AbstractFlowScanner.java:250)
	at …
	at org.jenkinsci.plugins.pipeline.modeldefinition.Utils.findStageFlowNodes(Utils.groovy:238)
	at org.jenkinsci.plugins.pipeline.modeldefinition.Utils.findStageFlowNodes(Utils.groovy)
	at org.jenkinsci.plugins.pipeline.modeldefinition.Utils$findStageFlowNodes$9.callStatic(Unknown Source)
	at org.jenkinsci.plugins.pipeline.modeldefinition.Utils.markStageWithTag(Utils.groovy:310)
	at org.jenkinsci.plugins.pipeline.modeldefinition.Utils$markStageWithTag$8.callStatic(Unknown Source)
	at org.jenkinsci.plugins.pipeline.modeldefinition.Utils.markStageSkippedForConditional(Utils.groovy:400)
	at org.jenkinsci.plugins.pipeline.modeldefinition.Utils$markStageSkippedForConditional$15.callStatic(Unknown Source)
	at …
	at WorkflowScript.skipStage(WorkflowScript:…)
	at …

It seems the intention was for the return value of leastCommonAncestor to be nonempty, but the assert was not run in production and there is no diagnostic information here.

@jglick jglick added the bug label Aug 8, 2022
@jglick jglick requested review from car-roll and dwnusbaum August 8, 2022 19:14
@jglick jglick merged commit 4596ea5 into jenkinsci:master Oct 10, 2022
@jglick jglick deleted the NoSuchElementException branch October 10, 2022 21:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants