xadisk
  1. xadisk
  2. XADISK-110

Lock acquisition methods reset the interrupt flag before returning

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2
    • Fix Version/s: 1.2.1
    • Component/s: filesystem
    • Labels:
      None

      Description

      Methods acquireSharedLock/acquireExclusiveLock in NativeConcurrencyControl, which are used to acquire lock over file/directory objects, invoke method removeDependencyFromRDG before returning. This method further clears the current-thread's interrupt flag. Such clearing of interrupt flag was introduced for cases when the lock acquisition was interrupted as part of handling of deadlock or transaction timeout; the interrupt flag should not be cleared in other normal cases.

        Activity

        Hide
        Nitin Verma added a comment -

        Some relevant points:

        1. Even if we could detect an interrupt and confirm the cause of the interrupt to be deadlock/timeout handling, there may still be some external system which interrupted in addition. But putting a check for deadlock/timeout cases, we can only reduce the chance of clearing an interrupt flag which was simultaneously set by someone else.

        2. Not clearing the interrupt flag altogether is also not an option. When a deadlock/timeout detector interrupts the thread during lock acquisition method, the InterruptedException may or may not arrive (for example, if the thread has just completed its waiting for lock and preparing to return the lock). As InterruptedException may not always get thrown, we may still be left with the interrupt flag set. So, it would be required to clear it before returning. If an interrupt is generated inside xadisk system, it should be handled and (flag) cleared without affecting the thread's status after executing the xadisk methods.

        Show
        Nitin Verma added a comment - Some relevant points: 1. Even if we could detect an interrupt and confirm the cause of the interrupt to be deadlock/timeout handling, there may still be some external system which interrupted in addition. But putting a check for deadlock/timeout cases, we can only reduce the chance of clearing an interrupt flag which was simultaneously set by someone else. 2. Not clearing the interrupt flag altogether is also not an option. When a deadlock/timeout detector interrupts the thread during lock acquisition method, the InterruptedException may or may not arrive (for example, if the thread has just completed its waiting for lock and preparing to return the lock). As InterruptedException may not always get thrown, we may still be left with the interrupt flag set. So, it would be required to clear it before returning. If an interrupt is generated inside xadisk system, it should be handled and (flag) cleared without affecting the thread's status after executing the xadisk methods.
        Hide
        Nitin Verma added a comment -

        Checked-in the changes to trunk.

        Show
        Nitin Verma added a comment - Checked-in the changes to trunk.

          People

          • Assignee:
            Nitin Verma
            Reporter:
            Nitin Verma
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: