[jboss-jira] [JBoss JIRA] (JGRP-2299) LockService does not work correctly if unlock/lock is called in immediate succession

David White (Jira) issues at jboss.org
Tue Mar 19 17:54:00 EDT 2019


    [ https://issues.jboss.org/browse/JGRP-2299?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13710605#comment-13710605 ] 

David White commented on JGRP-2299:
-----------------------------------

We are seeing a similar issue in version 4.0.19. We are testing with multiple threads attempting to lock on a single resource. During the unlock operation we sometimes get a NullPointerException and we cannot figure out where this is coming from.

[591:Thread-557] [2019-03-19 17:31:51.181] ERROR  java.lang.NullPointerException
org.jgroups.util.Owner.compareTo(Owner.java:56)
org.jgroups.protocols.Locking$ClientLock.compareTo(Locking.java:1141)
org.jgroups.protocols.Locking$ClientLock.compareTo(Locking.java:941)
java.util.concurrent.ConcurrentSkipListMap.cpr(ConcurrentSkipListMap.java:666)
java.util.concurrent.ConcurrentSkipListMap.doPut(ConcurrentSkipListMap.java:910)
java.util.concurrent.ConcurrentSkipListMap.putIfAbsent(ConcurrentSkipListMap.java:1990)
java.util.concurrent.ConcurrentSkipListSet.add(ConcurrentSkipListSet.java:252)
org.jgroups.protocols.Locking$ClientLockTable.addToPendingReleaseRequests(Locking.java:1302)
org.jgroups.protocols.Locking$ClientLock._unlock(Locking.java:1069)
org.jgroups.protocols.Locking$ClientLock.unlock(Locking.java:995)
org.jgroups.protocols.Locking.down(Locking.java:175)
org.jgroups.stack.ProtocolStack.down(ProtocolStack.java:908)
org.jgroups.JChannel.down(JChannel.java:668)
org.jgroups.blocks.locking.LockService$LockImpl.unlock(LockService.java:167)
...

I'm not sure what version of JGroups introduced this issue. It did not happen in a very old version of JGroups, 3.4.0.Alpha2.

> LockService does not work correctly if unlock/lock is called in immediate succession
> ------------------------------------------------------------------------------------
>
>                 Key: JGRP-2299
>                 URL: https://issues.jboss.org/browse/JGRP-2299
>             Project: JGroups
>          Issue Type: Bug
>    Affects Versions: 4.0.15
>         Environment: Windows 10 Oracle JDK 1.8 131
> AIX IBM Java 8
>            Reporter: Mirko Streckenbach
>            Assignee: Bela Ban
>            Priority: Major
>             Fix For: 4.0.20
>
>         Attachments: JGroupsExample.java, udp+lock.xml
>
>
> 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().



--
This message was sent by Atlassian Jira
(v7.12.1#712002)


More information about the jboss-jira mailing list