[ https://issues.apache.org/jira/browse/HBASE-5329?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Zhihong Yu updated HBASE-5329: ------------------------------ Description: {code} protected long addRowLock(Integer r, HRegion region) throws LeaseStillHeldException { long lockId = -1L; lockId = rand.nextLong(); //!!!may generate duplicated id,bug? String lockName = String.valueOf(lockId); rowlocks.put(lockName, r); this.leases.createLease(lockName, new RowLockListener(lockName, region)); return lockId; } {code} In addRowLock(),rand may generate duplicated lock id, it may cause regionserver throw exception(Leases$LeaseStillHeldException).The client will be blocked until old rowlock is released. {code} 2012-02-03 15:21:50,084 ERROR org.apache.hadoop.hbase.regionserver.HRegionServer: Error obtaining row lock (fsOk: true) org.apache.hadoop.hbase.regionserver.Leases$LeaseStillHeldException at org.apache.hadoop.hbase.regionserver.Leases.createLease(Leases.java:150) at org.apache.hadoop.hbase.regionserver.HRegionServer.addRowLock(HRegionServer.java:1986) at org.apache.hadoop.hbase.regionserver.HRegionServer.lockRow(HRegionServer.java:1963) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.hadoop.hbase.ipc.HBaseRPC$Server.call(HBaseRPC.java:570) at org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1039) {code} was: protected long addRowLock(Integer r, HRegion region) throws LeaseStillHeldException { long lockId = -1L; lockId = rand.nextLong(); //!!!may generate duplicated id,bug? String lockName = String.valueOf(lockId); rowlocks.put(lockName, r); this.leases.createLease(lockName, new RowLockListener(lockName, region)); return lockId; } In addRowLock(),rand may generate duplicated lock id, it may cause regionserver throw exception(Leases$LeaseStillHeldException).The client will be blocked until old rowlock is released. 2012-02-03 15:21:50,084 ERROR org.apache.hadoop.hbase.regionserver.HRegionServer: Error obtaining row lock (fsOk: true) org.apache.hadoop.hbase.regionserver.Leases$LeaseStillHeldException at org.apache.hadoop.hbase.regionserver.Leases.createLease(Leases.java:150) at org.apache.hadoop.hbase.regionserver.HRegionServer.addRowLock(HRegionServer.java:1986) at org.apache.hadoop.hbase.regionserver.HRegionServer.lockRow(HRegionServer.java:1963) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:597) at org.apache.hadoop.hbase.ipc.HBaseRPC$Server.call(HBaseRPC.java:570) at org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1039) I think we should call putIfAbsent(). If the return value from putIfAbsent() is not null, we should try to regenerate a new lockId. Do you want to upload a patch ? > when client call lockRow,region server may allocate duplicated lock id, this > may cause that client is blocked. > --------------------------------------------------------------------------------------------------------------- > > Key: HBASE-5329 > URL: https://issues.apache.org/jira/browse/HBASE-5329 > Project: HBase > Issue Type: Bug > Components: regionserver > Affects Versions: 0.90.3 > Environment: Red Hat Enterprise Linux Server release 5.4 > Reporter: liaoxiangui > > {code} > protected long addRowLock(Integer r, HRegion region) throws > LeaseStillHeldException > { > long lockId = -1L; > lockId = rand.nextLong(); //!!!may generate duplicated > id,bug? > String lockName = String.valueOf(lockId); > rowlocks.put(lockName, r); > this.leases.createLease(lockName, new RowLockListener(lockName, > region)); > return lockId; > } > {code} > In addRowLock(),rand may generate duplicated lock id, it may cause > regionserver throw exception(Leases$LeaseStillHeldException).The client will > be blocked until old rowlock is released. > {code} > 2012-02-03 15:21:50,084 ERROR > org.apache.hadoop.hbase.regionserver.HRegionServer: Error obtaining row lock > (fsOk: true) > org.apache.hadoop.hbase.regionserver.Leases$LeaseStillHeldException > at > org.apache.hadoop.hbase.regionserver.Leases.createLease(Leases.java:150) > at > org.apache.hadoop.hbase.regionserver.HRegionServer.addRowLock(HRegionServer.java:1986) > at > org.apache.hadoop.hbase.regionserver.HRegionServer.lockRow(HRegionServer.java:1963) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:597) > at org.apache.hadoop.hbase.ipc.HBaseRPC$Server.call(HBaseRPC.java:570) > at > org.apache.hadoop.hbase.ipc.HBaseServer$Handler.run(HBaseServer.java:1039) > {code} -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa For more information on JIRA, see: http://www.atlassian.com/software/jira