[jboss-jira] [JBoss JIRA] (JGRP-1679) tryLock with (and without) timeout allows simultaneous concurrent access to not thread-safe data to more then one client
Bela Ban (JIRA)
jira-events at lists.jboss.org
Thu Aug 22 06:56:26 EDT 2013
[ https://issues.jboss.org/browse/JGRP-1679?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12798414#comment-12798414 ]
Bela Ban commented on JGRP-1679:
--------------------------------
Ok, I think I know what the problem is:
- Thread T1 calls tryLock(timeout) on lock L
- The coordinator gets the GRANT-LOCK request and sends back a LOCK-GRANTED response
- Before the LOCK-GRANTED response is received, T1 times out and removes the client lock
- T1 now creates a new client lock L (same name) and tries to acquire it again
- Say L is held by someone else, so a LOCK-DENIED response is sent back
- Before T1 gets the LOCK-DENIED response, the *old LOCK-GRANTED* response is received
- This sets L to 'acquired' although it should be denied !
SOLUTION:
* Mark client locks with unique lock IDs and send those IDs with lock requests
* When a lock response is received and its request ID doesn't match the client lock's ID, discard the response
* In the above example, the old LOCK-GRANTED response would be discarded by the 2nd client lock L created by T2
> tryLock with (and without) timeout allows simultaneous concurrent access to not thread-safe data to more then one client
> ------------------------------------------------------------------------------------------------------------------------
>
> Key: JGRP-1679
> URL: https://issues.jboss.org/browse/JGRP-1679
> Project: JGroups
> Issue Type: Bug
> Affects Versions: 3.2.4, 3.3.4
> Environment: Intel(R) Core(TM) i5-2310 CPU @ 2.90GHz
> 8 GB RAM
> Windows 7
> JRE 1.6.31
> Reporter: Architect SoftWeb.ISD
> Assignee: Bela Ban
> Fix For: 3.4
>
> Attachments: lockservice_stability_testcase.jar
>
>
> It looks as it is possible to access a not thread-safe data simultaneously by several clients when tryLock with timeout is used.
> It is reproduced easily with timeouts from 1 to 3 seconds inclusive.
> It is very difficult to reproduce the issue with bigger values of the timeout.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira
More information about the jboss-jira
mailing list