[infinispan-dev] Lock ordering under optimistic locking

Radim Vansa rvansa at redhat.com
Fri Nov 9 03:24:30 EST 2012


Hi,

in OptimisticLockingInterceptor, the keys are ordered according to their hash. However, the hashes can still collide, which may result in a deadlock if two keys with identical hash (only 32-bit) are sorted to different order. The locks would time-out, but shouldn't we at least try to check if the keys are Comparable or let user provide some comparator class in config, and use the compare of hash only as the last resort? (and in all cases emit warning into log if the compare operation had non-strict result).
It's a minor problem (considering other current locking issues), but I wouldn't want to investigate why such deadlock happened :)
Btw., in OLE.visitPrepareCommand the log.tracef("Using lock reordering, order is: %s", orderedKeys); does not work, only the first key is printed out.

Radim

-----------------------------------------------------------
Radim Vansa
Quality Assurance Engineer
JBoss Datagrid
tel. +420532294559 ext. 62559

Red Hat Czech, s.r.o.
Brno, Purkyňova 99/71, PSČ 612 45
Czech Republic




More information about the infinispan-dev mailing list