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

Cannot remove synced files on Windows with 'Force clean and sync'

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Blocker Blocker
    • p4-plugin
    • P4-Plugin 1.11.5/1.9.6
      Jenkins 2.263.1/2.289.1
      Windows 10 - java version "1.8.0_291"

      The second time 'force clean and sync' is run on a Windows slave it fails because it cannot delete the files it synced as read only  (default workspace behavior) during the last build. Error seen in console logs is:

      ERROR: P4: Task Exception: java.io.IOException: Unable to delete file: E:\filestore\Jenkins\Windows10Swarm202\workspace\Windows10FreeStyle
      Finished: FAILURE

       

      Reproduction Steps:

      (1) Start a windows slave. For example using the following batch file:

      java -jar agent.jar -jnlpUrl http://192.168.1.206:8080/computer/Windows10Swarm202/slave-agent.jnlp -secret 84a63b33bf56069052a2c4fe31be101b80a76810e1835c6831c81f8acb4752aa -workDir "E:\filestore\Jenkins\Windows10Swarm202"
      

      (2) Create a freestyle job that does a 'Force clean and sync'.

      (3) Execute the job. All files are synced to the workspace as read-only.

      (4) Execute the job a seconds time. Job fails during the rm -rf command:

      P4 Task: establishing connection.
      ... server: 192.168.1.206:1666
      ... node: DESKTOP-E4NIR9M
      
      P4 Task: reverting all pending and shelved revisions.
      ... p4 revert E:\filestore\Jenkins\Windows10Swarm202\workspace\Windows10FreeStyle/...
       +... rm [abandoned files]
      duration: (7ms)
      
      ... p4 sync E:\filestore\Jenkins\Windows10Swarm202\workspace\Windows10FreeStyle/...#non___
       +... rm -rf E:\filestore\Jenkins\Windows10Swarm202\workspace\Windows10FreeStyle
      
      P4 Task: attempt: 1
      ERROR: P4: Task Exception: java.io.IOException: Unable to delete file: E:\filestore\Jenkins\Windows10Swarm202\workspace\Windows10FreeStyle
      Finished: FAILURE

      When you check the workspace, no files have been deleted.

       

      Windows process moitor showed that it failed trying to delete a synced file that is not open by any other process:

      Note - When 'delete workspace before build starts' is used the same call works but the files have been moved???

       

      Workarounds:

      If you manually go onto the build node and remove the 'Read Only' flag agsinst the synced files it works.

      If you always use the 'allwrite' client option on the Perforce workspace used it also works.

      If you choose the the Jenkins option 'Delete workspace before build starts' it works.

      Therefore the Jenkins slave has permission to remove the files, it's just the P4-Plugin that cannot.

       

       

       

       

       

       

       

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

              Created:
              Updated:
              Resolved: