hbase-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Serega Sheypak <serega.shey...@gmail.com>
Subject HConnectionManager leaks with zookeeper conection oo many connections from /my.tomcat.server.com - max is 60
Date Fri, 12 Dec 2014 10:47:51 GMT
Hi, I'm using HConnectionManager from java servlet
Looks like it's leaking, all my zookeepers complains that there is too many
connections from servlet hosts.
Typical line from lZK log:

oo many connections from /my.tomcat.server.com  - max is 60


Here is code sample

public class BaseConnection {

    private static final Logger LOG =
LoggerFactory.getLogger(BaseConnection.class);

    protected void close(HConnection connection){
        try{
            if(connection == null){
                return;
            }
            connection.close();
        }
        catch (Exception e){
            LOG.warn("Error while closing HConnection", e);
        }
    }

    protected void close(HTableInterface hTable){
        try{
            if(hTable == null){
                return;
            }
            hTable.close();
        }
        catch (Exception e){
            LOG.warn("Error while closing HTable", e);
        }
    }
}

sample PUT code from subclass:

public void put(List<MyBean> entries){
    HConnection hConnection = null;
    HTableInterface hTable = null;
    try {
        List<Put> puts = new ArrayList<Put>(entries.size());
        for(MyBean myBean : entries){
            puts.add(new MyBeanSerDe().createPut(myBean));
        }
        hConnection = HConnectionManager.createConnection(configuration);
        hTable = hConnection.getTable(NAME_B);
        hTable.put(puts);

    }catch (Exception e){
        LOG.error("Error while doing bulk put", e);
    }finally{
        close(hTable);
        close(hConnection);
    }
}

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message