Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8238568

Basic Directory Model has a deadlock bug

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • None
    • client-libs

      The code in BasicDirectoryModel.java acquires synchronization objects in different order (once acquires DoChangeContents.this and then fileCache, another time acquires fileCache and then DoChangeContents.this).

      Acquiring synchronization objects in different order can cause circular wait (deadlock).

      Here is the first order: (1) first acquire DoChangeContents.this and then fileCache:

      enter public method run() at line 473
      acquire synchronization on DoChangeContents.this at entry to run() because run() is a synchronized method --- see line 473
      acquire synchronization on fileCache at line 477
      Here is the second order: (2) first acquire fileCache and then DoChangeContents.this:

      enter public method renameFile() at line 155
      acquire synchronization on fileCache at line 156
      call validateFileCache() at line 158
      call cancelRunnables() at line 135
      call cancelRunnables(Vector) at line 346
      call cancel() at line 341
      acquire synchronization on DoChangeContents.this at entry to cancel() because cancel() is a synchronized method --- see line 469

            serb Sergey Bylokhov
            azeemj Azeem Jiva
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: