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

Moving a Build Job to a Folder results in Exception and loss of build history

      When I try to move an existing Job to a Folder I get an exception error, and the move completes only partially. The Job is inside the new folder, but build history is lost. Settings for the Job are still ok, it will also build with the correct next build number.

      Stack trace
      org.apache.commons.io.FileExistsException: Destination 'c:\Jenkins\LB47x\LB_SAMPLE\builds' already exists
      at org.apache.commons.io.FileUtils.moveDirectory(FileUtils.java:2748)
      at hudson.model.Job.movedTo(Job.java:682)
      at hudson.model.Items.move(Items.java:438)
      at com.cloudbees.hudson.plugins.folder.relocate.StandardHandler.doMove(StandardHandler.java:72)
      at com.cloudbees.hudson.plugins.folder.relocate.StandardHandler.handle(StandardHandler.java:64)
      at com.cloudbees.hudson.plugins.folder.relocate.DefaultRelocationUI.doMove(DefaultRelocationUI.java:121)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
      at java.lang.reflect.Method.invoke(Unknown Source)
      at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:324)
      at org.kohsuke.stapler.interceptor.RequirePOST$Processor.invoke(RequirePOST.java:52)
      at org.kohsuke.stapler.PreInvokeInterceptedFunction.invoke(PreInvokeInterceptedFunction.java:26)
      at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:167)
      at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:100)
      at org.kohsuke.stapler.MetaClass$1.doDispatch(MetaClass.java:124)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:813)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
      at org.kohsuke.stapler.MetaClass$11.dispatch(MetaClass.java:380)
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
      at org.kohsuke.stapler.MetaClass$5.doDispatch(MetaClass.java:233)
      at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:58)
      at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:746)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:876)
      at org.kohsuke.stapler.Stapler.invoke(Stapler.java:649)
      at org.kohsuke.stapler.Stapler.service(Stapler.java:238)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
      at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:135)
      at com.smartcodeltd.jenkinsci.plugin.assetbundler.filters.LessCSS.doFilter(LessCSS.java:47)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
      at hudson.plugins.greenballs.GreenBallFilter.doFilter(GreenBallFilter.java:59)
      at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:132)
      at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:126)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:49)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:84)
      at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:51)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at jenkins.security.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:117)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at org.acegisecurity.providers.anonymous.AnonymousProcessingFilter.doFilter(AnonymousProcessingFilter.java:125)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at org.acegisecurity.ui.rememberme.RememberMeProcessingFilter.doFilter(RememberMeProcessingFilter.java:142)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at org.acegisecurity.ui.AbstractProcessingFilter.doFilter(AbstractProcessingFilter.java:271)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:93)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at org.acegisecurity.context.HttpSessionContextIntegrationFilter.doFilter(HttpSessionContextIntegrationFilter.java:249)
      at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:67)
      at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:87)
      at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:76)
      at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:171)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:49)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:81)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
      at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143)
      at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:553)
      at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:223)
      at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
      at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
      at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      at org.eclipse.jetty.server.Server.handle(Server.java:499)
      at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:311)
      at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
      at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:544)
      at winstone.BoundedExecutorService$1.run(BoundedExecutorService.java:77)
      at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

          [JENKINS-35093] Moving a Build Job to a Folder results in Exception and loss of build history

          Daniel Beck added a comment -

          Let me guess: Windows Search service is running? Or maybe an antivirus is running?

          Daniel Beck added a comment - Let me guess: Windows Search service is running? Or maybe an antivirus is running?

          Thomas Hieber added a comment -

          Antivirus is running for sure - this could explain if this happend once, but this happens all the time. I moved now about 10 Jobs, and each and every one failed. (I was able to manually copy the builds Directory into the target Directory, and after a restart of the Jenkins Service build history was back...)

          Thomas Hieber added a comment - Antivirus is running for sure - this could explain if this happend once, but this happens all the time. I moved now about 10 Jobs, and each and every one failed. (I was able to manually copy the builds Directory into the target Directory, and after a restart of the Jenkins Service build history was back...)

          Wim Coenen added a comment - - edited

          I have the same issue. The trick to reproduce it appears to be to configure the Workspace Root Directory and Build Record Root Directory (the settings hidden under "advanced" on the /configure page).

          I have tested and reproduced with these settings in a fresh Jenkins instance:

          Workspace Root Directory = c:\users\wcoen_000\jenkins\workspaces\${ITEM_FULLNAME}
          Build Record Root Directory = c:\users\wcoen_000\jenkins\builds\${ITEM_FULLNAME}
          

          Next I created a trivial job which executes "echo test > test" and archives the resulting test file.

          Next I tried to move this job into a folder.

          Wim Coenen added a comment - - edited I have the same issue. The trick to reproduce it appears to be to configure the Workspace Root Directory and Build Record Root Directory (the settings hidden under "advanced" on the /configure page). I have tested and reproduced with these settings in a fresh Jenkins instance: Workspace Root Directory = c:\users\wcoen_000\jenkins\workspaces\${ITEM_FULLNAME} Build Record Root Directory = c:\users\wcoen_000\jenkins\builds\${ITEM_FULLNAME} Next I created a trivial job which executes "echo test > test" and archives the resulting test file. Next I tried to move this job into a folder.

          Thomas Hieber added a comment - - edited

          I can confirm, this is also the case for us. we have set Build Record Root Directory to

          c:\Jenkins\${ITEM_FULL_NAME}\builds 
          

          and Build Record Root Directory to

          c:\Jenkins\${ITEM_FULL_NAME}\workspace.
          

          Thomas Hieber added a comment - - edited I can confirm, this is also the case for us. we have set Build Record Root Directory to c:\Jenkins\${ITEM_FULL_NAME}\builds and Build Record Root Directory to c:\Jenkins\${ITEM_FULL_NAME}\workspace.

          Ivan Fofanov added a comment -

          Same issue in Unix

          Ivan Fofanov added a comment - Same issue in Unix

          Hagit Segev added a comment -

          Happens to me too. Must restart Jenkins after that. Unix system.

          Hagit Segev added a comment - Happens to me too. Must restart Jenkins after that. Unix system.

          Edgars Batna added a comment -

          Just happened to a large job for us.

          Edgars Batna added a comment - Just happened to a large job for us.

            Unassigned Unassigned
            hieber Thomas Hieber
            Votes:
            9 Vote for this issue
            Watchers:
            11 Start watching this issue

              Created:
              Updated: