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

Build creates second workspace@2 for non-concurrent build configuration

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Minor Minor
    • core, matrix-project-plugin
    • None
    • OS: Ubuntu 12.04 64-bit
      Jenkins: 1.609.1 (upgraded from 1.580.3)
      disk-usage plugin: 0.25 (upgraded from 0.24)
      Matrix Project Plugin: 1.6 (upgraded from 1.4.1)
    • Jenkins Core 2.136

      I didn't have this issue when I was using ver 1.580.3.
      After upgrading Jenkins ver 1.609.1 (together with other Jenkins plugins update),
      I started to see this issue.

      My jenkins job is using multi-config project type (aka Matrix project),
      and has 3 variants.
      I didn't set to be run concurrently,
      so the 3 variants will start the build one by one.

      In the previous version 1.580.3,
      it will reuse the same workspace folder for all of 3 variant builds.

      In the new version 1.609.1,
      when multiple jobs are triggerd,
      I can see sometimes the first variant build of the second job
      will start to create and use workspace@2
      instead of re-using original worksapce.

      Note:
      I'm also using disk-usage plugin.
      At the end of build,
      it will trigger that plugin to calculate workspace disk space.
      My work space tends to be large and sometimes it take several minutes to finish.

      I suspect it's that disk-usage plugin still occupying the original worksapce,
      but the second job in queue starts earlier,
      so it creates workspace@2 for the first variable build.

      From workspace@2,
      I always see only one variant only under AXIS folder.

          [JENKINS-30231] Build creates second workspace@2 for non-concurrent build configuration

          Jatin Mehta added a comment - - edited

          kamil02, I don't have admin access to restart Jenkins master. Besides, thats only a temporary workaround. If this was a permanent solution, it shouldn't have cropped up for a new project (or same project with its name changed for that matter). It is still a bug. Will try to come up with a more consistent way to produce it. 

          Jatin Mehta added a comment - - edited kamil02 , I don't have admin access to restart Jenkins master. Besides, thats only a temporary workaround. If this was a permanent solution, it shouldn't have cropped up for a new project (or same project with its name changed for that matter). It is still a bug. Will try to come up with a more consistent way to produce it. 

          Adam Kolarik added a comment -

          I'm seeing this issue on version 2.176.1. We also don't have concurrent or Matrix builds setup, just one executor per node. On one specific node, we got the workspace@2 duplicated workspace. I tried deleting both workspaces on the node manually and restart Jenkins server to see if that helps and it did.

          Adam Kolarik added a comment - I'm seeing this issue on version 2.176.1. We also don't have concurrent or Matrix builds setup, just one executor per node. On one specific node, we got the workspace@2 duplicated workspace. I tried deleting both workspaces on the node manually and restart Jenkins server to see if that helps and it did.

          Kamil Szuster added a comment -

          Today the same error occurred again: Jenkins created a ..@2 and ...@3 folder in the .../workspace directory. I had to delete these via SSH and restart the master => back to normal job workspace again.  

          Jenkins ver. 2.176.3

          Kamil Szuster added a comment - Today the same error occurred again: Jenkins created a ..@2 and ...@3 folder in the .../workspace directory. I had to delete these via SSH and restart the master => back to normal job workspace again.   Jenkins ver. 2.176.3

          Peter Shen added a comment - - edited

          I have the same issue on Jenkins ver. 2.176.3.

          Peter Shen added a comment - - edited I have the same issue on Jenkins ver. 2.176.3.

          I have the same issue with Jenkins version 2.222.3

          I have admin access, so I rebooted Jenkins master after deleting ..@2 folder. This did not help either.

          Naveen Sathyanarayana added a comment - I have the same issue with Jenkins version 2.222.3 I have admin access, so I rebooted Jenkins master after deleting ..@2 folder. This did not help either.

          Sten Olsson added a comment -

          I also have this problem.  I checkout two repositories into my workspace and often times Jenkins creates a second workspace for the parallel-running job which checks out the second repo.  The tools assume they are in the same workspace and promptly fail.  Possible workaround might be to save the location of WORKSPACE in the beginning and then with each parallel task, always change directory (cd) back to that location before doing anything. 

          For example,

          Sten Olsson added a comment - I also have this problem.  I checkout two repositories into my workspace and often times Jenkins creates a second workspace for the parallel-running job which checks out the second repo.  The tools assume they are in the same workspace and promptly fail.  Possible workaround might be to save the location of WORKSPACE in the beginning and then with each parallel task, always change directory (cd) back to that location before doing anything.  For example,

          Sten Olsson added a comment -

          dnusbaum - I see that the issue is marked as Resolved.  In this case, should a new issue be created or the preference is to Reopen?  I didn't want to reopen if it really needs to be a new issue instead.

          Sten Olsson added a comment - dnusbaum - I see that the issue is marked as Resolved.  In this case, should a new issue be created or the preference is to Reopen?  I didn't want to reopen if it really needs to be a new issue instead.

          Devin Nusbaum added a comment -

          olssons My guess is that there are probably many distinct issues being reported here (e.g. some scenarios are likely specific to (multibranch) pipelines, but there were also bugs fixed that affected freestyle and other project types). I would go ahead and open a new issue with full details on your specific case, ideally with steps on how to reproduce the problem from scratch.

          Devin Nusbaum added a comment - olssons My guess is that there are probably many distinct issues being reported here (e.g. some scenarios are likely specific to (multibranch) pipelines, but there were also bugs fixed that affected freestyle and other project types). I would go ahead and open a new issue with full details on your specific case, ideally with steps on how to reproduce the problem from scratch.

          Sten Olsson added a comment -

          dnusbaum - With my issue, the double workspace never occurs during the "Build Software" parallel tasks.  However, when I have 3 parallel tasks in a row, like under "Analysis and Adaptation", this is where the problem sometimes happens.  I say sometimes because it happens maybe half the time or 3 out of 4 builds in a row. 

          I first started my workarounds by removing the second checkout like I mentioned before (see "Checkout tools" above).  That did not fix the problem.  I then made all the tasks in Analysis and Adaptation serial.  That (obviously) fixed the problem.  If I were to guess, it didn't like 3 tasks running in parallel, all using the same workspace.  My builds take about 10-15 minutes longer now, but no more failures at least.

          I may open an issue in the future. 

          PS - I could never recreate the problem from the Jenkins Pipeline script, only from a checked in Jenkinsfile itself

          Sten Olsson added a comment - dnusbaum - With my issue, the double workspace never occurs during the "Build Software" parallel tasks.  However, when I have 3 parallel tasks in a row, like under "Analysis and Adaptation", this is where the problem sometimes happens.  I say sometimes because it happens maybe half the time or 3 out of 4 builds in a row.  I first started my workarounds by removing the second checkout like I mentioned before (see "Checkout tools" above).  That did not fix the problem.  I then made all the tasks in Analysis and Adaptation serial.  That (obviously) fixed the problem.  If I were to guess, it didn't like 3 tasks running in parallel, all using the same workspace.  My builds take about 10-15 minutes longer now, but no more failures at least. I may open an issue in the future.  PS - I could never recreate the problem from the Jenkins Pipeline script, only from a checked in Jenkinsfile itself

          Ori Wiesel added a comment -

          Is there anyway to disable this option?

          so no new workspace will be created and only the original workspace will be used alone? (I'm aware of the risks)

          Ori Wiesel added a comment - Is there anyway to disable this option? so no new workspace will be created and only the original workspace will be used alone? (I'm aware of the risks)

            dnusbaum Devin Nusbaum
            totoroliu Rick Liu
            Votes:
            4 Vote for this issue
            Watchers:
            22 Start watching this issue

              Created:
              Updated:
              Resolved: