pulsar-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From GitBox <...@apache.org>
Subject [GitHub] merlimat opened a new pull request #2710: Avoid NullPointerException in ZK server stats collection
Date Wed, 03 Oct 2018 19:43:05 GMT
merlimat opened a new pull request #2710: Avoid NullPointerException in ZK server stats collection
URL: https://github.com/apache/pulsar/pull/2710
 
 
   ### Motivation
   
   The call to `serverStats().getNumAliveClientConnections()` inside ZK server is throwing
NPE in some cases where the `ServerCnxnFactory` is null. 
   
   ```
   22:07:04.269 [qtp33419717-17] WARN  org.eclipse.jetty.servlet.ServletHandler - /metrics
   java.lang.NullPointerException: null
   	at org.apache.zookeeper.server.ZooKeeperServer.getNumAliveConnections(ZooKeeperServer.java:883)
~[org.apache.pulsar-pulsar-broker-2.2.0-streamlio-4.jar:2.2.0-streamlio-4]
   	at org.apache.zookeeper.server.ServerStats.getNumAliveClientConnections(ServerStats.java:90)
~[org.apache.pulsar-pulsar-broker-2.2.0-streamlio-4.jar:2.2.0-streamlio-4]
   	at org.apache.pulsar.zookeeper.ZooKeeperServerAspect$3.get(ZooKeeperServerAspect.java:74)
~[org.apache.pulsar-pulsar-zookeeper-2.2.0-streamlio-4.jar:2.2.0-streamlio-4]
   	at io.prometheus.client.Gauge.collect(Gauge.java:295) ~[io.prometheus-simpleclient-0.0.23.jar:?]
   	at io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.findNextElement(CollectorRegistry.java:180)
~[io.prometheus-simpleclient-0.0.23.jar:?]
   	at io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.nextElement(CollectorRegistry.java:213)
~[io.prometheus-simpleclient-0.0.23.jar:?]
   	at io.prometheus.client.CollectorRegistry$MetricFamilySamplesEnumeration.nextElement(CollectorRegistry.java:134)
~[io.prometheus-simpleclient-0.0.23.jar:?]
   	at io.prometheus.client.exporter.common.TextFormat.write004(TextFormat.java:22) ~[io.prometheus-simpleclient_common-0.0.23.jar:?]
   	at io.prometheus.client.exporter.MetricsServlet.doGet(MetricsServlet.java:43) ~[io.prometheus-simpleclient_servlet-0.0.23.jar:?]
   ```
   
   This also break the metrics output since it won't print any more metrics after this exception.
   
   ### Modifications
   
   Bypass the `ServerStats` object and directly get the info on the `ServerCnxnFactory`, validating
that it's not null.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

Mime
View raw message