[ 
https://issues.apache.org/jira/browse/RATIS-1446?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Xu Shao Hong updated RATIS-1446:
--------------------------------
    Description: 
 
{code:java}
1private void yieldLeaderToHigherPriorityPeer() {
2  if (!server.getInfo().isLeader()) {
3    return;
4  }

5  final RaftConfigurationImpl conf = server.getRaftConf();
6  int leaderPriority = conf.getPeer(server.getId()).getPriority(); {code}
During my test in k8s env, I met the corner case where the ozone progress met 
NPE and was shut down. The log shows it is thrown at line 6. It is possible in 
some cases configuration may not include the server itself. The case happened 
when bootstrapping the second SCM. Thus there should have a null check before 
getPriority.

-------

The attachment is the error log caught.

  was:
 
{code:java}
1private void yieldLeaderToHigherPriorityPeer() {
2  if (!server.getInfo().isLeader()) {
3    return;
4  }

5  final RaftConfigurationImpl conf = server.getRaftConf();
6  int leaderPriority = conf.getPeer(server.getId()).getPriority(); {code}
During my test in k8s env, I met the corner case where the ozone progress met 
NPE and was shut down. The log shows it is thrown at line 6. It is possible in 
some cases configuration may not include the server itself. The case happened 
when bootstrapping the second SCM. Thus there should have a null check before 
getPriority.

 


> should avoid NPE in yieldLeaderToHigherPriorityPeer
> ---------------------------------------------------
>
>                 Key: RATIS-1446
>                 URL: https://issues.apache.org/jira/browse/RATIS-1446
>             Project: Ratis
>          Issue Type: Bug
>            Reporter: Xu Shao Hong
>            Priority: Critical
>         Attachments: npe-1
>
>
>  
> {code:java}
> 1private void yieldLeaderToHigherPriorityPeer() {
> 2  if (!server.getInfo().isLeader()) {
> 3    return;
> 4  }
> 5  final RaftConfigurationImpl conf = server.getRaftConf();
> 6  int leaderPriority = conf.getPeer(server.getId()).getPriority(); {code}
> During my test in k8s env, I met the corner case where the ozone progress met 
> NPE and was shut down. The log shows it is thrown at line 6. It is possible 
> in some cases configuration may not include the server itself. The case 
> happened when bootstrapping the second SCM. Thus there should have a null 
> check before getPriority.
> -------
> The attachment is the error log caught.



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to