Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-63783

timestamper plugin occurred file already exists exception after build a job

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Minor
    • Resolution: Unresolved
    • Labels:
      None
    • Environment:
      os: centos 7.6
      java: jdk 1.8.0_261
      jenkins: 2.257
      timestamper plugin: 1.11.5
    • Similar Issues:

      Description

      When myjob start build, I'll see the "File already exists"  IOException in jenkins log, such as:

       WARNING h.p.t.TimestamperBuildWrapper$ConsoleLogFilterImpl#decorateLogger: File already exists: ${jenkins_home}/jobs/${myjob}/builds/204/timestamper/timestamps
      java.io.IOException: File already exists: ${jenkins_home}/jobs/${myjob}/builds/204/timestamper/timestamps
      at hudson.plugins.timestamper.io.TimestampsWriter.<init>(TimestampsWriter.java:86)
      at hudson.plugins.timestamper.TimestamperBuildWrapper$ConsoleLogFilterImpl.decorateLogger(TimestamperBuildWrapper.java:114)
      at jenkins.tasks.SimpleBuildWrapper.decorateLogger(SimpleBuildWrapper.java:193)
      at hudson.maven.MavenBuild$ProxyImpl2.<init>(MavenBuild.java:600)
      at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:733)
      at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:514)
      at hudson.model.Run.execute(Run.java:1894)
      at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
      at hudson.model.ResourceController.execute(ResourceController.java:97)
      at hudson.model.Executor.run(Executor.java:428)

      in the old jenkins server (jenkins 2.120, timestamper 1.8.9) has no this exception
       

       

        Attachments

          Issue Links

            Activity

            Hide
            atecha Andrew Wietecha added a comment - - edited

            We're also seeing the same issue.

            OS: Red Hat Enterprise Linux Server, Version:  7.7 (Maipo)
            Java: openjdk version 1.8.0_242
            Jenkins: 2.249.1
            Timestamper plugin: 1.11.5 (same as Hon Go)

            I can't pinpoint when this happens. Sometimes it happens on the very next build, sometimes a few consecutive builds run successfully (with no code changes between builds), then the next one, Jenkins will get stuck, with the log showing:

            WARNING h.p.t.TimestamperBuildWrapper$ConsoleLogFilterImpl#decorateLogger: File already exists: ${jenkins_home}/jobs/${my job}/builds/17/timestamper/timestamps
            java.io.IOException: File already exists: ${jenkins_home}/jobs/${my job}/builds/17/timestamper/timestamps
            at hudson.plugins.timestamper.io.TimestampsWriter.<init>(TimestampsWriter.java:86)
            at hudson.plugins.timestamper.TimestamperBuildWrapper$ConsoleLogFilterImpl.decorateLogger(TimestamperBuildWrapper.java:114)
            at jenkins.tasks.SimpleBuildWrapper.decorateLogger(SimpleBuildWrapper.java:193)
            at hudson.maven.MavenBuild$ProxyImpl2.<init>(MavenBuild.java:600)
            at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:733)
            at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
            at hudson.model.Run.execute(Run.java:1894)
            at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
            at hudson.model.ResourceController.execute(ResourceController.java:97)
            at hudson.model.Executor.run(Executor.java:428)

            Show
            atecha Andrew Wietecha added a comment - - edited We're also seeing the same issue. OS:  Red Hat Enterprise Linux Server, Version:  7.7 (Maipo) Java: openjdk version 1.8.0_242 Jenkins: 2.249.1 Timestamper plugin: 1.11.5 (same as Hon Go) I can't pinpoint when this happens. Sometimes it happens on the very next build, sometimes a few consecutive builds run successfully (with no code changes between builds), then the next one, Jenkins will get stuck, with the log showing: WARNING h.p.t.TimestamperBuildWrapper$ConsoleLogFilterImpl#decorateLogger: File already exists: ${jenkins_home}/jobs/${my job}/builds/17/timestamper/timestamps java.io.IOException: File already exists: ${jenkins_home}/jobs/${my job}/builds/17/timestamper/timestamps at hudson.plugins.timestamper.io.TimestampsWriter.<init>(TimestampsWriter.java:86) at hudson.plugins.timestamper.TimestamperBuildWrapper$ConsoleLogFilterImpl.decorateLogger(TimestamperBuildWrapper.java:114) at jenkins.tasks.SimpleBuildWrapper.decorateLogger(SimpleBuildWrapper.java:193) at hudson.maven.MavenBuild$ProxyImpl2.<init>(MavenBuild.java:600) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:733) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504) at hudson.model.Run.execute(Run.java:1894) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:428)
            Hide
            timja Tim Jacomb added a comment -
            Show
            timja Tim Jacomb added a comment - Basil Crow fyi
            Hide
            basil Basil Crow added a comment -

            There was no code change in Timestamper that would have caused this regression. The code change that caused this regression was in version 3.4 of the Maven Integration plugin. Previous versions of the Maven Integration plugin do not show this error. The error is reproducible with the following test in the Maven Integration plugin, using any version of Timestamper (tested with 1.10 and 1.11.7):

            package hudson.maven;
            
            import static org.junit.Assert.assertNotNull;
            import static org.junit.Assert.assertTrue;
            
            import hudson.Launcher;
            import hudson.model.BuildListener;
            import hudson.plugins.timestamper.TimestamperBuildWrapper;
            import hudson.tasks.Maven;
            
            import org.junit.Rule;
            import org.junit.Test;
            import org.jvnet.hudson.test.ExtractResourceSCM;
            import org.jvnet.hudson.test.ToolInstallations;
            
            import java.io.IOException;
            
            public class TimestamperTest {
                @Rule public MavenJenkinsRule j = new MavenJenkinsRule();
            
                @Test
                public void testTimestamper() throws Exception {
                    MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class);
                    Maven.MavenInstallation mavenInstallation = ToolInstallations.configureMaven35();
                    project.setMaven(mavenInstallation.getName());
                    project.getReporters().add(new TestReporter());
                    project.setScm(new ExtractResourceSCM(getClass().getResource("maven3-project.zip")));
                    project.setGoals("clean install");
                    project.getBuildWrappersList().add(new TimestamperBuildWrapper());
                    MavenModuleSetBuild build = j.buildAndAssertSuccess(project);
                    assertTrue(MavenUtil.maven3orLater(build.getMavenVersionUsed()));
                }
            
                private static class TestReporter extends MavenReporter {
                    @Override
                    public boolean end(MavenBuild build, Launcher launcher, BuildListener listener)
                            throws InterruptedException, IOException {
                        assertNotNull(build.getProject().getWorkspace());
                        assertNotNull(build.getWorkspace());
                        return true;
                    }
                }
            }
            

            Note that the test sometimes passes and the sometimes fails, but the following is always (incorrectly!) logged:

               4.796 [id=43]	WARNING	h.p.t.TimestamperBuildWrapper$ConsoleLogFilterImpl#decorateLogger: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps
            java.io.IOException: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps
            	at hudson.plugins.timestamper.io.TimestampsWriter.<init>(TimestampsWriter.java:86)
            	at hudson.plugins.timestamper.TimestamperBuildWrapper$ConsoleLogFilterImpl.decorateLogger(TimestamperBuildWrapper.java:114)
            	at jenkins.tasks.SimpleBuildWrapper.decorateLogger(SimpleBuildWrapper.java:193)
            	at hudson.maven.MavenBuild$ProxyImpl2.<init>(MavenBuild.java:600)
            	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:731)
            	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
            	at hudson.model.Run.execute(Run.java:1853)
            	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
            	at hudson.model.ResourceController.execute(ResourceController.java:97)
            	at hudson.model.Executor.run(Executor.java:427)
               4.797 [id=43]	WARNING	h.p.t.TimestamperBuildWrapper$ConsoleLogFilterImpl#decorateLogger: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps
            java.io.IOException: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps
            	at hudson.plugins.timestamper.io.TimestampsWriter.<init>(TimestampsWriter.java:86)
            	at hudson.plugins.timestamper.TimestamperBuildWrapper$ConsoleLogFilterImpl.decorateLogger(TimestamperBuildWrapper.java:114)
            	at jenkins.tasks.SimpleBuildWrapper.decorateLogger(SimpleBuildWrapper.java:193)
            	at hudson.maven.MavenBuild$ProxyImpl2.<init>(MavenBuild.java:600)
            	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:731)
            	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
            	at hudson.model.Run.execute(Run.java:1853)
            	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
            	at hudson.model.ResourceController.execute(ResourceController.java:97)
            	at hudson.model.Executor.run(Executor.java:427)
               4.797 [id=43]	WARNING	h.p.t.TimestamperBuildWrapper$ConsoleLogFilterImpl#decorateLogger: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps
            java.io.IOException: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps
            	at hudson.plugins.timestamper.io.TimestampsWriter.<init>(TimestampsWriter.java:86)
            	at hudson.plugins.timestamper.TimestamperBuildWrapper$ConsoleLogFilterImpl.decorateLogger(TimestamperBuildWrapper.java:114)
            	at jenkins.tasks.SimpleBuildWrapper.decorateLogger(SimpleBuildWrapper.java:193)
            	at hudson.maven.MavenBuild$ProxyImpl2.<init>(MavenBuild.java:600)
            	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:731)
            	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
            	at hudson.model.Run.execute(Run.java:1853)
            	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
            	at hudson.model.ResourceController.execute(ResourceController.java:97)
            	at hudson.model.Executor.run(Executor.java:427)
               4.797 [id=43]	WARNING	h.p.t.TimestamperBuildWrapper$ConsoleLogFilterImpl#decorateLogger: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps
            java.io.IOException: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps
            	at hudson.plugins.timestamper.io.TimestampsWriter.<init>(TimestampsWriter.java:86)
            	at hudson.plugins.timestamper.TimestamperBuildWrapper$ConsoleLogFilterImpl.decorateLogger(TimestamperBuildWrapper.java:114)
            	at jenkins.tasks.SimpleBuildWrapper.decorateLogger(SimpleBuildWrapper.java:193)
            	at hudson.maven.MavenBuild$ProxyImpl2.<init>(MavenBuild.java:600)
            	at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:731)
            	at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504)
            	at hudson.model.Run.execute(Run.java:1853)
            	at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543)
            	at hudson.model.ResourceController.execute(ResourceController.java:97)
            	at hudson.model.Executor.run(Executor.java:427)
            

            This is a regression introduced by SECURITY-713 in commit 23e3fe5. If one reverts the changes made in SECURITY-713 …

            diff --git a/src/main/java/hudson/maven/MavenBuild.java b/src/main/java/hudson/maven/MavenBuild.java
            index cbd3819..d9ddc3f 100644
            --- a/src/main/java/hudson/maven/MavenBuild.java
            +++ b/src/main/java/hudson/maven/MavenBuild.java
            @@ -588,17 +588,14 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> {
                     
                     private final SplittableBuildListener listener;
                     long startTime;
            -        private OutputStream log;
            +        private final OutputStream log;
                     private final MavenModuleSetBuild parentBuild;
                     private boolean blockBuildEvents;
             
            -        ProxyImpl2(MavenModuleSetBuild parentBuild,SplittableBuildListener listener) throws FileNotFoundException, IOException, InterruptedException {
            +        ProxyImpl2(MavenModuleSetBuild parentBuild,SplittableBuildListener listener) throws FileNotFoundException {
                         this.parentBuild = parentBuild;
                         this.listener = listener;
                         log = new FileOutputStream(getLogFile()); // no buffering so that AJAX clients can see the log live
            -            for(BuildWrapper wrapper : project.getParent().getBuildWrappersList()){
            -                log = wrapper.decorateLogger( parentBuild, log );
            -            }
                     }
             
                     public void start() {
            

            … then the test passes without logging "File already exists."

            FYI Olivier Lamy

            Show
            basil Basil Crow added a comment - There was no code change in Timestamper that would have caused this regression. The code change that caused this regression was in version 3.4 of the Maven Integration plugin. Previous versions of the Maven Integration plugin do not show this error. The error is reproducible with the following test in the Maven Integration plugin, using any version of Timestamper (tested with 1.10 and 1.11.7): package hudson.maven; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import hudson.Launcher; import hudson.model.BuildListener; import hudson.plugins.timestamper.TimestamperBuildWrapper; import hudson.tasks.Maven; import org.junit.Rule; import org.junit.Test; import org.jvnet.hudson.test.ExtractResourceSCM; import org.jvnet.hudson.test.ToolInstallations; import java.io.IOException; public class TimestamperTest { @Rule public MavenJenkinsRule j = new MavenJenkinsRule(); @Test public void testTimestamper() throws Exception { MavenModuleSet project = j.jenkins.createProject(MavenModuleSet.class); Maven.MavenInstallation mavenInstallation = ToolInstallations.configureMaven35(); project.setMaven(mavenInstallation.getName()); project.getReporters().add( new TestReporter()); project.setScm( new ExtractResourceSCM(getClass().getResource( "maven3-project.zip" ))); project.setGoals( "clean install" ); project.getBuildWrappersList().add( new TimestamperBuildWrapper()); MavenModuleSetBuild build = j.buildAndAssertSuccess(project); assertTrue(MavenUtil.maven3orLater(build.getMavenVersionUsed())); } private static class TestReporter extends MavenReporter { @Override public boolean end(MavenBuild build, Launcher launcher, BuildListener listener) throws InterruptedException, IOException { assertNotNull(build.getProject().getWorkspace()); assertNotNull(build.getWorkspace()); return true ; } } } Note that the test sometimes passes and the sometimes fails, but the following is always (incorrectly!) logged: 4.796 [id=43] WARNING h.p.t.TimestamperBuildWrapper$ConsoleLogFilterImpl#decorateLogger: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps java.io.IOException: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps at hudson.plugins.timestamper.io.TimestampsWriter.<init>(TimestampsWriter.java:86) at hudson.plugins.timestamper.TimestamperBuildWrapper$ConsoleLogFilterImpl.decorateLogger(TimestamperBuildWrapper.java:114) at jenkins.tasks.SimpleBuildWrapper.decorateLogger(SimpleBuildWrapper.java:193) at hudson.maven.MavenBuild$ProxyImpl2.<init>(MavenBuild.java:600) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:731) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504) at hudson.model.Run.execute(Run.java:1853) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:427) 4.797 [id=43] WARNING h.p.t.TimestamperBuildWrapper$ConsoleLogFilterImpl#decorateLogger: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps java.io.IOException: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps at hudson.plugins.timestamper.io.TimestampsWriter.<init>(TimestampsWriter.java:86) at hudson.plugins.timestamper.TimestamperBuildWrapper$ConsoleLogFilterImpl.decorateLogger(TimestamperBuildWrapper.java:114) at jenkins.tasks.SimpleBuildWrapper.decorateLogger(SimpleBuildWrapper.java:193) at hudson.maven.MavenBuild$ProxyImpl2.<init>(MavenBuild.java:600) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:731) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504) at hudson.model.Run.execute(Run.java:1853) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:427) 4.797 [id=43] WARNING h.p.t.TimestamperBuildWrapper$ConsoleLogFilterImpl#decorateLogger: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps java.io.IOException: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps at hudson.plugins.timestamper.io.TimestampsWriter.<init>(TimestampsWriter.java:86) at hudson.plugins.timestamper.TimestamperBuildWrapper$ConsoleLogFilterImpl.decorateLogger(TimestamperBuildWrapper.java:114) at jenkins.tasks.SimpleBuildWrapper.decorateLogger(SimpleBuildWrapper.java:193) at hudson.maven.MavenBuild$ProxyImpl2.<init>(MavenBuild.java:600) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:731) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504) at hudson.model.Run.execute(Run.java:1853) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:427) 4.797 [id=43] WARNING h.p.t.TimestamperBuildWrapper$ConsoleLogFilterImpl#decorateLogger: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps java.io.IOException: File already exists: /tmp/j h1676225579373443216/jobs/p/builds/1/timestamper/timestamps at hudson.plugins.timestamper.io.TimestampsWriter.<init>(TimestampsWriter.java:86) at hudson.plugins.timestamper.TimestamperBuildWrapper$ConsoleLogFilterImpl.decorateLogger(TimestamperBuildWrapper.java:114) at jenkins.tasks.SimpleBuildWrapper.decorateLogger(SimpleBuildWrapper.java:193) at hudson.maven.MavenBuild$ProxyImpl2.<init>(MavenBuild.java:600) at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.doRun(MavenModuleSetBuild.java:731) at hudson.model.AbstractBuild$AbstractBuildExecution.run(AbstractBuild.java:504) at hudson.model.Run.execute(Run.java:1853) at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:543) at hudson.model.ResourceController.execute(ResourceController.java:97) at hudson.model.Executor.run(Executor.java:427) This is a regression introduced by SECURITY-713 in commit 23e3fe5 . If one reverts the changes made in SECURITY-713 … diff --git a/src/main/java/hudson/maven/MavenBuild.java b/src/main/java/hudson/maven/MavenBuild.java index cbd3819..d9ddc3f 100644 --- a/src/main/java/hudson/maven/MavenBuild.java +++ b/src/main/java/hudson/maven/MavenBuild.java @@ -588,17 +588,14 @@ public class MavenBuild extends AbstractMavenBuild<MavenModule,MavenBuild> { private final SplittableBuildListener listener; long startTime; - private OutputStream log; + private final OutputStream log; private final MavenModuleSetBuild parentBuild; private boolean blockBuildEvents; - ProxyImpl2(MavenModuleSetBuild parentBuild,SplittableBuildListener listener) throws FileNotFoundException, IOException, InterruptedException { + ProxyImpl2(MavenModuleSetBuild parentBuild,SplittableBuildListener listener) throws FileNotFoundException { this.parentBuild = parentBuild; this.listener = listener; log = new FileOutputStream(getLogFile()); // no buffering so that AJAX clients can see the log live - for(BuildWrapper wrapper : project.getParent().getBuildWrappersList()){ - log = wrapper.decorateLogger( parentBuild, log ); - } } public void start() { … then the test passes without logging "File already exists." FYI Olivier Lamy

              People

              Assignee:
              Unassigned Unassigned
              Reporter:
              honsen Hon Go
              Votes:
              8 Vote for this issue
              Watchers:
              12 Start watching this issue

                Dates

                Created:
                Updated: