Description
HConnectionManager.HBASE_INSTANCES is a WeakHashMap from HBaseConfiguration to TableServers. However, each TableServers has a strong reference back to the HBaseConfiguration key so they are never freed. (See note at http://java.sun.com/javase/6/docs/api/java/util/WeakHashMap.html : "Implementation note: The value objects in a WeakHashMap are held by ordinary strong references. Thus care should be taken to ensure that value objects do not strongly refer to their own keys, either directly or indirectly, since that will prevent the keys from being discarded.")
Moreover, HBaseConfiguration implements hashCode() but not equals() so identical HBaseConfiguration objects each get their own TableServers object.
We had a long running HBase client process that was creating new HTable() objects, each creating a new HBaseConfiguration() and thus a new TableServers object. It eventually went OOM, and gave a heap dump indicating 360 MB of data retained by HBASE_INSTANCES.
Attachments
Attachments
Issue Links
- is cloned by
-
HBASE-2925 LRU of HConnectionManager.HBASE_INSTANCES breaks if HBaseConfiguration is changed
- Closed
- is related to
-
HBASE-1251 HConnectionManager.getConnection(HBaseConfiguration) returns same HConnection for different HBaseConfigurations
- Closed
-
HBASE-1976 HBaseConfiguration implements hashCode() without implementing equals()
- Closed