1. Ivy
  2. IVY-1388

*.lck files created by "artifact-lock" lock strategy are not cleaned up if ivy quits abruptly


    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.2.0, 2.3.0-RC1, master
    • Fix Version/s: 2.3.0
    • Component/s: None
    • Labels:


      We have a few build processes running in parallel, all of which share the same ivy cache. In order not to run into any parallel downloading problems, we enabled artifact-lock lock strategy. An annoying problem with the artifact-lock strategy is that the *.lck files which are created as a lock are not cleaned up if the build exits abruptly. For example, while ivy is downloading a big jar, if you Ctrl-C to quit that build process. Those lock files will remain in the metadatas folder. The same happens too if ivy encounters some error and fails the build.

      Those uncleaned lock files will cause problem when you start the build again. The build process will hang while ivy waiting those "locks" to be released, which will never happen automatically. So eventually the build will fail with an ivy error "impossible to acquire lock for xxxyyyzzzz". What makes it worse is that ivy doesn't fail-fast on the default 2 miuntes lock timeout, it seems trying it a few times. In worst scenarios, we have seen the build hangs for 12 minutes and then timeout'd and failed.

      We believe this can be fixed by setting deleteOnExit() for the FileBasedLockStrategy.java class. We have implemented the fix and it works well.

      Patch is provided, could anyone quickly apply this one line change?

      1. patch1.patch
        2 kB
        Wei Chen
      2. FileBasedLockStrategy.java.patch
        0.5 kB
        Wei Chen

        Issue Links


          Wei Chen created issue -
          Wei Chen made changes -
          Field Original Value New Value
          Attachment FileBasedLockStrategy.java.patch [ 12552847 ]
          Wei Chen made changes -
          Attachment patch1.patch [ 12552964 ]
          Nicolas Lalevée made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Nicolas Lalevée [ hibou ]
          Fix Version/s trunk [ 12320744 ]
          Resolution Fixed [ 1 ]
          Nicolas Lalevée made changes -
          Fix Version/s 2.3.0 [ 12323508 ]
          Shawn Heisey made changes -
          Link This issue blocks LUCENE-4636 [ LUCENE-4636 ]
          Maarten Coene made changes -
          Fix Version/s trunk [ 12320744 ]
          Gavin made changes -
          Link This issue blocks LUCENE-4636 [ LUCENE-4636 ]
          Gavin made changes -
          Link This issue is depended upon by LUCENE-4636 [ LUCENE-4636 ]
          Shawn Heisey made changes -
          Link This issue relates to IVY-1489 [ IVY-1489 ]


            • Assignee:
              Nicolas Lalevée
              Wei Chen
            • Votes:
              3 Vote for this issue
              8 Start watching this issue


              • Created:

                Time Tracking

                Original Estimate - 0.5m
                Remaining Estimate - 0.5m
                Time Spent - Not Specified
                Not Specified