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

build fails because p4tickets.txt is locked by another build

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Minor Minor
    • p4-plugin
    • None

      When multiple builds are started at the same time, it sometimes happens that the p4tickets.txt file is locked, and the plugin gives up.

       

      Could the plugin be adapted to wait a short time and try again?

       

      I have the impression that there is a retry mechanism in p4java, but it appears not to be active.  (or does not work as expected)

       

      This is the error :
       
       p4 login
       
       P4: Unable to setup workspace: com.perforce.p4java.exception.ConnectionException: com.perforce.p4java.exception.ConfigException: java.nio.file.FileSystemException: C:\Users\XXXXXXXX\p4tickets.txt.lck: The process cannot access the file because it is being used by another process.
       
           at com.perforce.p4java.impl.mapbased.rpc.packet.RpcPacketDispatcher.dispatch(RpcPacketDispatcher.java:225)
           at com.perforce.p4java.impl.mapbased.rpc.OneShotServerImpl.execMapCmdList(OneShotServerImpl.java:363)
           at com.perforce.p4java.impl.mapbased.rpc.OneShotServerImpl.execMapCmdList(OneShotServerImpl.java:203)
           at com.perforce.p4java.impl.mapbased.server.cmd.BaseDelegator.execMapCmdList(BaseDelegator.java:139)
           at com.perforce.p4java.impl.mapbased.server.cmd.LoginDelegator.login(LoginDelegator.java:131)
           at com.perforce.p4java.impl.mapbased.server.cmd.LoginDelegator.login(LoginDelegator.java:111)
           at com.perforce.p4java.impl.mapbased.server.cmd.LoginDelegator.login(LoginDelegator.java:85)
           at com.perforce.p4java.impl.mapbased.server.Server.login(Server.java:2422)
           at org.jenkinsci.plugins.p4.client.SessionHelper.login(SessionHelper.java:157)
           at org.jenkinsci.plugins.p4.client.ClientHelper.clientLogin(ClientHelper.java:129)
           at org.jenkinsci.plugins.p4.client.ClientHelper.<init>(ClientHelper.java:104)
           at org.jenkinsci.plugins.p4.tasks.AbstractTask.tryTask(AbstractTask.java:171)
           at org.jenkinsci.plugins.p4.tasks.CheckoutTask.invoke(CheckoutTask.java:165)
           at org.jenkinsci.plugins.p4.tasks.CheckoutTask.invoke(CheckoutTask.java:35)
           at hudson.FilePath$FileCallableWrapper.call(FilePath.java:3492)
           at hudson.remoting.UserRequest.perform(UserRequest.java:211)
           at hudson.remoting.UserRequest.perform(UserRequest.java:54)
           at hudson.remoting.Request$2.run(Request.java:376)
           at hudson.remoting.InterceptingExecutorService.lambda$wrap$0(InterceptingExecutorService.java:78)
           at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
           at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
           at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
           at hudson.remoting.Engine$1.lambda$newThread$0(Engine.java:121)
           at java.base/java.lang.Thread.run(Thread.java:829)
       Caused by: com.perforce.p4java.exception.ConnectionException: com.perforce.p4java.exception.ConfigException: java.nio.file.FileSystemException: C:\Users\XXXXXXXX\p4tickets.txt.lck: The process cannot access the file because it is being used by another process.
       
           at com.perforce.p4java.impl.mapbased.rpc.func.client.ClientUserInteraction.clientSetPassword(ClientUserInteraction.java:383)
           at com.perforce.p4java.impl.mapbased.rpc.func.client.ClientFunctionDispatcher.dispatch(ClientFunctionDispatcher.java:193)
           at com.perforce.p4java.impl.mapbased.rpc.packet.RpcPacketDispatcher.dispatch(RpcPacketDispatcher.java:160)
           ... 23 more
       Caused by: com.perforce.p4java.exception.ConfigException: java.nio.file.FileSystemException: C:\Users\XXXXXXXX\p4tickets.txt.lck: The process cannot access the file because it is being used by another process.
       
           at com.perforce.p4java.impl.mapbased.rpc.RpcServer.quietSaveTicket(RpcServer.java:1540)
           at com.perforce.p4java.impl.mapbased.rpc.RpcServer.saveTicket(RpcServer.java:1495)
           at com.perforce.p4java.impl.mapbased.rpc.func.client.ClientUserInteraction.clientSetPassword(ClientUserInteraction.java:381)
           ... 25 more
       Caused by: java.nio.file.FileSystemException: C:\Users\XXXXXXXX\p4tickets.txt.lck: The process cannot access the file because it is being used by another process.
       
           at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
           at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
           at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
           at java.base/sun.nio.fs.WindowsFileSystemProvider.implDelete(WindowsFileSystemProvider.java:274)
           at java.base/sun.nio.fs.AbstractFileSystemProvider.deleteIfExists(AbstractFileSystemProvider.java:110)
           at java.base/java.nio.file.Files.deleteIfExists(Files.java:1181)
           at com.perforce.p4java.server.AbstractAuthHelper.saveFileEntry(AbstractAuthHelper.java:225)
           at com.perforce.p4java.server.AuthTicketsHelper.saveTicket(AuthTicketsHelper.java:284)
           at com.perforce.p4java.server.AuthTicketsHelper.saveTicket(AuthTicketsHelper.java:248)
           at com.perforce.p4java.impl.mapbased.rpc.RpcServer.quietSaveTicket(RpcServer.java:1533)
           ... 27 more
       
       ERROR: P4: Task Exception: com.perforce.p4java.exception.ConfigException: java.nio.file.FileSystemException: C:\Users\XXXXXXXX\p4tickets.txt.lck: The process cannot access the file because it is being used by another process.
       

       

          [JENKINS-69949] build fails because p4tickets.txt is locked by another build

          Karl Wirth added a comment -

          HI lleroy - Are you already using 'Enable User Session'?

          It's under the 'Advanced' button for the credential:

          In recent testing this dropped the number of accesses for the ticket file for a simple job from over 100 to only one access every 30 seconds (because the session life is 30 seconds).

          Karl Wirth added a comment - HI lleroy - Are you already using 'Enable User Session'? It's under the 'Advanced' button for the credential: In recent testing this dropped the number of accesses for the ticket file for a simple job from over 100 to only one access every 30 seconds (because the session life is 30 seconds).

          lode leroy added a comment -

          p4karl  - thanks for the hint, I'll give that a try!

          lode leroy added a comment - p4karl   - thanks for the hint, I'll give that a try!

            Unassigned Unassigned
            lleroy lode leroy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: