[infinispan-issues] [JBoss JIRA] (ISPN-2395) Key sorting done by the OptimisticLockingInterceptor is incompatible with the lock striping

Mircea Markus (JIRA) jira-events at lists.jboss.org
Mon Jul 1 11:44:21 EDT 2013


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

Mircea Markus commented on ISPN-2395:
-------------------------------------

you can disable lock stripping and this will work. A solution for this would be to allow the use provide their own lock comparator used for sorting the locks. Not a very high prio IMO, but let's keep the JIRA around in case it gets some traction.
                
> Key sorting done by the OptimisticLockingInterceptor is incompatible with the lock striping
> -------------------------------------------------------------------------------------------
>
>                 Key: ISPN-2395
>                 URL: https://issues.jboss.org/browse/ISPN-2395
>             Project: Infinispan
>          Issue Type: Bug
>          Components: Locking and Concurrency
>    Affects Versions: 5.1.5.FINAL, 5.1.6.FINAL, 5.1.7.Final, 5.2.0.Beta1
>            Reporter: Nicolas Filotto
>            Assignee: Mircea Markus
>         Attachments: TestLocking.java
>
>
> In ISPN 5.0, you provided a workaround allowing us to sort the keys ourself in order to prevent deadlocks even in case we enable the lock striping (more details here ISPN-993), thanks to this workaround we could write a simple key comparator (that works with lock striping enabled or not) as next:
> {code}
> public int compare(Object k1, Object k2) {
>   LockManager lm = cache.getLockManager();
>   int result = lm.getLockId(key1) - lm.getLockId(k2);
> }
> {code}
> Starting from ISPN 5.1 (ISPN-1132), the keys are sorted automatically by ISPN however unfortunately what has been done is incompatible with lock striping, indeed the keys are sorted regardless the lock distribution which is a mistake since we actually expect the keys to be sorted according to the corresponding locks and not to the keys themselves otherwise deadlock can still occur.
> As attached file, you will find a test case that shows the issue.

--
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 infinispan-issues mailing list