Uploaded image for project: 'JGroups'
  1. JGroups
  2. JGRP-2299

LockService does not work correctly if unlock/lock is called in immediate succession

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 4.1.2
    • 4.0.15
    • None

    Description

      In our application we have encountered occasional cases of LockService allowing 2 processes to hold the same lock at the same time. I could reproduce this with a simple program (see atttachment) and it happens if for a lock "unlock" is called and immediately afterwards "lock". If there is a small delay (e.g. 1 second) between the two operations everything works as expected.

      This can be produced with the attached program. The program does lock/unlock/lock on a lock and then tries to lock the same lock from a different JChannel and is awarded the lock. If you place a small sleep() after the unlock, everything works as expected and the parallel lock is not awarded.

      If you turn on debugging you'll see no output between unlock and lock, so it looks to me like the lock is awarded without passing GRANT_LOCK messages to the stack. Using a conditional break point you can see that ClientLock.acquired is still true even after the unlock().

      Attachments

        1. image.png
          image.png
          3 kB
        2. JGroupsExample.java
          1 kB
        3. udp+lock.xml
          2 kB

        Activity

          People

            rhn-engineering-bban Bela Ban
            pms11 Mirko Streckenbach (Inactive)
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: