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

Workspace cleanup thread creates new workspaces

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Minor Minor
    • p4-plugin
    • 1.17.1

      The workspace cleanup thread calls "processWorkspaceBeforeDeletion":

      https://github.com/jenkinsci/jenkins/blob/e34bdcfdc0665c064dd825cf0d33a949bfd23c44/core/src/main/java/hudson/model/WorkspaceCleanupThread.java#L125

       

      This check causes new workspaces to be created for every job on every node:

      2025/01/21 16:32:40 pid 3938459 jenkins@jenkins-myclient_MyTestJob 1.2.3.4 [jenkins.p4-plugin/1.17.0/Windows_11] 'user-info'
      2025/01/21 16:32:40 pid 3938460 jenkins@jenkins-myclient_MyTestJob 1.2.3.4 [jenkins.p4-plugin/1.17.0/Windows_11] 'user-info'
      2025/01/21 16:32:40 pid 3938461 jenkins@jenkins-myclient_MyTestJob 1.2.3.4 [jenkins.p4-plugin/1.17.0/Windows_11] 'user-client -o jenkins-myclient_MyTestJob' 
      2025/01/21 16:32:40 pid 3938462 jenkins@jenkins-myclient_MyTestJob 1.2.3.4 [jenkins.p4-plugin/1.17.0/Windows_11] 'user-client -i'
       

      These workspaces are never used and never deleted.

      Would be great if P4Jenkins tested in 'processWorkspaceBeforeDeletion' that a client exists before performing 'p4 client -o' and then 'p4 client -i'.

       

      Reproduction Steps:

      (1) Create 3 build agents.

      (2) Create a single job that is pinned to only one of the agents.

      (3) Wait for workspace cleanup to run (or find a way to trigger it).

      (4) Check if a workspace has been created for every agent for this job.

       

       

       

          [JENKINS-75250] Workspace cleanup thread creates new workspaces

          Karl Wirth added a comment -

          We also think this is causing workspaces to be updated with the wrong client root. For example:

          issuingServerCommand: (9) client -o jenkins_MyNODE_project_update_editor
          4月 14, 2025 8:51:04 午前 最も詳細 org.jenkinsci.plugins.p4.console.P4Logging
          completedServerCommand: (9) in 40ms
          4月 14, 2025 8:51:04 午前 最も詳細 org.jenkinsci.plugins.p4.console.P4Logging
          issuingServerCommand: (10) client -i
          4月 14, 2025 8:51:04 午前 最も詳細 org.jenkinsci.plugins.p4.console.P4Logging
          completedServerCommand: (10) in 44ms
          4月 14, 2025 8:51:04 午前 詳細 org.jenkinsci.plugins.p4.client.ClientHelper
          ...   View:
                //MyDepot/develop/proj/....p4ignore //jenkins_MyNODE_project_update_editor/proj/....p4ignore
                -//MyDepot/develop/proj/admin/....p4ignore //jenkins_MyNODE_project_update_editor/proj/admin/....p4ignore
          eportClient/...
                //MyDepot/develop/proj/tools/ci/... //jenkins_MyNODE_project_update_editor/proj/tools/ci/...
                //MyDepot/develop/proj/tools/jenkins/... //jenkins_MyNODE_project_update_editor/proj/tools/jenkins/...
          ...   Stream: //MyDepot/jenkins_project
          ...   Root: d:\jenkins_agent\workspace\project_tag_editor    <<< Root is tag_editor. Should be 'update_editor'4月 14, 2025 8:51:04 午前 情報 org.jenkinsci.plugins.p4.tasks.RemoveClientTask task
          Task: remove client. 

          You can see that 'Task: remove client' was called but for the wrong project. 

          Karl Wirth added a comment - We also think this is causing workspaces to be updated with the wrong client root. For example: issuingServerCommand: (9) client -o jenkins_MyNODE_project_update_editor 4月 14, 2025 8:51:04 午前 最も詳細 org.jenkinsci.plugins.p4.console.P4Logging completedServerCommand: (9) in 40ms 4月 14, 2025 8:51:04 午前 最も詳細 org.jenkinsci.plugins.p4.console.P4Logging issuingServerCommand: (10) client -i 4月 14, 2025 8:51:04 午前 最も詳細 org.jenkinsci.plugins.p4.console.P4Logging completedServerCommand: (10) in 44ms 4月 14, 2025 8:51:04 午前 詳細 org.jenkinsci.plugins.p4.client.ClientHelper ...   View:       //MyDepot/develop/proj/....p4ignore //jenkins_MyNODE_project_update_editor/proj/....p4ignore       - //MyDepot/develop/proj/admin/....p4ignore //jenkins_MyNODE_project_update_editor/proj/admin/....p4ignore eportClient/...       //MyDepot/develop/proj/tools/ci/... //jenkins_MyNODE_project_update_editor/proj/tools/ci/...       //MyDepot/develop/proj/tools/jenkins/... //jenkins_MyNODE_project_update_editor/proj/tools/jenkins/... ...   Stream: //MyDepot/jenkins_project ...   Root: d:\jenkins_agent\workspace\project_tag_editor    <<< Root is tag_editor. Should be 'update_editor' 4月 14, 2025 8:51:04 午前 情報 org.jenkinsci.plugins.p4.tasks.RemoveClientTask task Task: remove client. You can see that 'Task: remove client' was called but for the wrong project. 

            Unassigned Unassigned
            p4karl Karl Wirth
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: