You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hbase.apache.org by "Moran (Jira)" <ji...@apache.org> on 2022/09/20 02:03:00 UTC

[jira] [Created] (HBASE-27379) numOpenConnections metric is one less than the actual

Moran created HBASE-27379:
-----------------------------

             Summary: numOpenConnections metric is one less than the actual 
                 Key: HBASE-27379
                 URL: https://issues.apache.org/jira/browse/HBASE-27379
             Project: HBase
          Issue Type: Bug
          Components: metrics
            Reporter: Moran


In HBASE-17263,serverChannel add to allChannels,so NumOpenConnections exclude serverChannel from the count.
{code:java}
public NettyRpcServer(final Server server, final String name,
    final List<BlockingServiceAndInterface> services,
    final InetSocketAddress bindAddress, Configuration conf,
    RpcScheduler scheduler) throws IOException {
  super(server, name, services, bindAddress, conf, scheduler);
  ...
  try {
    serverChannel = bootstrap.bind(this.bindAddress).sync().channel();
    LOG.info("NettyRpcServer bind to address=" + serverChannel.localAddress()
        + ", hbase.netty.rpc.server.worker.count=" + workerCount
        + ", useEpoll=" + useEpoll);
    allChannels.add(serverChannel);
  } catch (InterruptedException e) {
    throw new InterruptedIOException(e.getMessage());
  }
  ...
}

@Override
public int getNumOpenConnections() {
  // allChannels also contains the server channel, so exclude that from the count.
  return allChannels.size() - 1;
}{code}
In HBASE-17263,serverChannel not add to allChannels,so NumOpenConnections  is one less than the actual.
{code:java}
public NettyRpcServer(Server server, String name, List<BlockingServiceAndInterface> services,
    InetSocketAddress bindAddress, Configuration conf, RpcScheduler scheduler)
    throws IOException {
  ...
  try {
    serverChannel = bootstrap.bind(this.bindAddress).sync().channel();
    LOG.info("NettyRpcServer bind to address=" + serverChannel.localAddress());
  } catch (InterruptedException e) {
    throw new InterruptedIOException(e.getMessage());
  }
  ...
} {code}
In HBase-21610, I think it's actually influenced by this bug.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)