[ 
https://issues.apache.org/jira/browse/RATIS-717?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16954276#comment-16954276
 ] 

Aravindan Vijayan commented on RATIS-717:
-----------------------------------------

The NPE can happen in a node which moved from a leader to a follower state. The 
metric gauge still holds the commit index of the follower peer of this node 
when it was the leader. Now, this node is no longer the leader, hence the 
commitIndex map will not have the follower's indices.

> NPE thrown on the follower while instantiating RaftLeaderMetrics
> ----------------------------------------------------------------
>
>                 Key: RATIS-717
>                 URL: https://issues.apache.org/jira/browse/RATIS-717
>             Project: Ratis
>          Issue Type: Bug
>          Components: metrics
>    Affects Versions: 0.5.0
>            Reporter: Siddharth Wagle
>            Assignee: Aravindan Vijayan
>            Priority: Major
>             Fix For: 0.5.0
>
>         Attachments: RATIS-717-000.patch
>
>
> Error thrown while running Teragen on Ozone cluster.
> {code}
> Error getting metrics from source 
> ratis_core.ratis_leader.3b9b7dee-f9c7-48e0-af14-5c043e050b84@group-C1E270F4213F
> java.lang.NullPointerException
>     at 
> org.apache.ratis.server.impl.RaftLeaderMetrics.lambda$null$2(RaftLeaderMetrics.java:86)
>     at 
> com.github.joshelser.dropwizard.metrics.hadoop.HadoopMetrics2Reporter.snapshotAllMetrics(HadoopMetrics2Reporter.java:239)
>     at 
> com.github.joshelser.dropwizard.metrics.hadoop.HadoopMetrics2Reporter.getMetrics(HadoopMetrics2Reporter.java:219)
>     at 
> org.apache.hadoop.metrics2.impl.MetricsSourceAdapter.getMetrics(MetricsSourceAdapter.java:200)
>     at 
> org.apache.hadoop.metrics2.impl.MetricsSystemImpl.snapshotMetrics(MetricsSystemImpl.java:419)
>     at 
> org.apache.hadoop.metrics2.impl.MetricsSystemImpl.sampleMetrics(MetricsSystemImpl.java:406)
>     at 
> org.apache.hadoop.metrics2.impl.MetricsSystemImpl.onTimerEvent(MetricsSystemImpl.java:381)
>     at 
> org.apache.hadoop.metrics2.impl.MetricsSystemImpl$4.run(MetricsSystemImpl.java:368)
>     at java.util.TimerThread.mainLoop(Timer.java:555)
>     at java.util.TimerThread.run(Timer.java:505)
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to