Ivy
  1. Ivy
  2. IVY-1424

NIO FileLocker releases locks while still within tryLock() call

    Details

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

      Description

      The notes about NIOFileLocker being deprecated due to unreliability have an obvious cause – locks it grabs have already been released before the tryLock method has even exited due to the finally block closing the file descriptor on which the lock is held!

      (flock() or fcntl()-based locks, into one of which categories those created by NIO fall on modern Unixlike operating systems, are implicitly closed whenever the file handle on which they're held exits. This is highly desirable behavior, because it means that a lock is implicitly cleared on unclean shutdown of any sort – power failure, SIGKILL to the JVM, etc; this behavior is also perhaps the primary reason to prefer NIO locks to the approach taken by CreateFileLocker).

      1. ivy-nio-locker-fix.diff
        4 kB
        Charles Duffy (Indeed.com)
      2. ivy-nio-locker-as-option.diff
        6 kB
        Charles Duffy (Indeed.com)

        Activity

        Hide
        Maarten Coene added a comment -

        Sorry for the late response.

        I've fixed this in SVN trunk based on your patch.
        Thanks a lot!
        Maarten

        Show
        Maarten Coene added a comment - Sorry for the late response. I've fixed this in SVN trunk based on your patch. Thanks a lot! Maarten
        Hide
        Charles Duffy (Indeed.com) added a comment -

        Rather than only fixing the NIO locking system, additionally make it available as an individually-selectable option.

        Show
        Charles Duffy (Indeed.com) added a comment - Rather than only fixing the NIO locking system, additionally make it available as an individually-selectable option.

          People

          • Assignee:
            Maarten Coene
            Reporter:
            Charles Duffy (Indeed.com)
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development