diff --git a/pom.xml b/pom.xml index 0bccf1fa..8138024d 100644 --- a/pom.xml +++ b/pom.xml @@ -76,10 +76,16 @@ io.jenkins.tools.bom bom-${jenkins.baseline}.x - 3850.vb_c5319efa_e29 + 4023.va_eeb_b_4e45f07 import pom + + org.jenkins-ci.plugins.workflow + workflow-cps + + 999999-SNAPSHOT + @@ -107,7 +113,8 @@ org.jboss.marshalling jboss-marshalling-river - 2.2.2.Final + + 2.3.0.Final-SNAPSHOT org.jenkins-ci.plugins.workflow @@ -172,5 +179,30 @@ pipeline-stage-step test + + org.csanchez.jenkins.plugins + kubernetes + test + + + org.jenkins-ci.plugins + pipeline-maven + test + + + org.jenkinsci.plugins + pipeline-model-definition + test + + + io.jenkins.plugins + warnings-ng + test + + + org.jenkins-ci.plugins + parallel-test-executor + test + diff --git a/src/main/java/org/jenkinsci/plugins/workflow/support/pickles/serialization/RiverReader.java b/src/main/java/org/jenkinsci/plugins/workflow/support/pickles/serialization/RiverReader.java index 2a4264fc..7307005f 100644 --- a/src/main/java/org/jenkinsci/plugins/workflow/support/pickles/serialization/RiverReader.java +++ b/src/main/java/org/jenkinsci/plugins/workflow/support/pickles/serialization/RiverReader.java @@ -114,7 +114,7 @@ public RiverReader(File f, ClassLoader classLoader, FlowExecutionOwner owner) th this.owner = owner; } - private int parseHeader(DataInputStream din) throws IOException { + static int parseHeader(DataInputStream din) throws IOException { if (din.readLong() != RiverWriter.HEADER) { throw new IOException("Invalid stream header"); } diff --git a/src/test/java/org/jenkinsci/plugins/workflow/support/pickles/serialization/RiverReaderStackOverflowErrorDiag.java b/src/test/java/org/jenkinsci/plugins/workflow/support/pickles/serialization/RiverReaderStackOverflowErrorDiag.java new file mode 100644 index 00000000..78a1f1cb --- /dev/null +++ b/src/test/java/org/jenkinsci/plugins/workflow/support/pickles/serialization/RiverReaderStackOverflowErrorDiag.java @@ -0,0 +1,76 @@ +/* + * The MIT License + * + * Copyright 2025 CloudBees, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + * THE SOFTWARE. + */ + +package org.jenkinsci.plugins.workflow.support.pickles.serialization; + +import java.nio.file.Files; +import java.nio.file.Path; +import org.apache.commons.io.FileUtils; +import org.jenkinsci.plugins.workflow.cps.CpsFlowExecution; +import org.jenkinsci.plugins.workflow.job.WorkflowJob; +import org.jenkinsci.plugins.workflow.job.WorkflowRun; +import static org.junit.Assume.assumeNotNull; +import org.junit.BeforeClass; +import org.junit.Rule; +import org.junit.Test; +import org.jvnet.hudson.test.JenkinsSessionRule; + +public final class RiverReaderStackOverflowErrorDiag { + + private static Path input; + + @BeforeClass public static void args() { + var path = System.getenv("BUILD_DIR"); + assumeNotNull("Define $BUILD_DIR to run", path); + input = Path.of(path); + } + + @Rule public JenkinsSessionRule rr = new JenkinsSessionRule(); + + @Test public void run() throws Throwable { + var jobDir = rr.getHome().toPath().resolve("jobs/xxx"); + var buildDir = jobDir.resolve("builds/1"); + FileUtils.copyDirectory(input.toFile(), buildDir.toFile()); + Files.writeString(jobDir.resolve("config.xml"), ""); // minimal WorkflowJob + var buildXml = buildDir.resolve("build.xml"); + Files.writeString(buildXml, Files.readString(buildXml). + replace("true", "false"). + replace("true", "false"). + replaceFirst("1:[0-9]+", "")); + Files.writeString(buildDir.resolve("log"), "\n"); + System.err.println("Loading " + input); + rr.then(r -> { + // TODO turn down logging on OldDataMonitor (we do not care about missing classes in build.xml) + var build = r.jenkins.getItemByFullName("xxx", WorkflowJob.class).getBuildByNumber(1); + try { + ((CpsFlowExecution) build.getExecution()).programPromise.get(); + System.err.println("Loaded."); + } catch (Exception x) { + x.printStackTrace(); + build.writeWholeLogTo(System.err); + } + }); + } + +}