You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-dev@hadoop.apache.org by "ConfX (Jira)" <ji...@apache.org> on 2023/07/27 14:45:00 UTC
[jira] [Created] (HADOOP-18831) Missing null check when running doRun method
ConfX created HADOOP-18831:
------------------------------
Summary: Missing null check when running doRun method
Key: HADOOP-18831
URL: https://issues.apache.org/jira/browse/HADOOP-18831
Project: Hadoop Common
Issue Type: Bug
Reporter: ConfX
Attachments: reproduce.sh
h2. What happened?
Got NullPointerException when running {{doRun}} method in {{{}ZKFailoverController.java{}}}.
h2. Where's the bug?
In line 106 of {{{}ZKFailoverController.java{}}},the code lacks a check to verify whether {{rpcServer}} is null or not.
{noformat}
private int doRun(String[] args)
throws Exception {
...
} catch (Exception e) {
LOG.error("The failover controller encounters runtime error: ", e);
throw e;
} finally {
rpcServer.stopAndJoin();
...
}{noformat}
As a result, when the configuration provides a null rpcServer, the {{rpcServer.stopAndJoin()}} operation will throw a NullPointerException.
It is essential to add a null check for the rpcServer parameter before using it.
h2. How to reproduce?
(1) set {{ipc.server.handler.queue.size}} to {{0}}
(2) run {{org.apache.hadoop.ha.TestZKFailoverController#testAutoFailoverOnLostZKSession}}
h2. Stacktrace
{noformat}
Caused by: java.lang.NullPointerException
at org.apache.hadoop.ha.ZKFailoverController.doRun(ZKFailoverController.java:258)
at org.apache.hadoop.ha.ZKFailoverController.access$000(ZKFailoverController.java:63)
at org.apache.hadoop.ha.ZKFailoverController$1.run(ZKFailoverController.java:181)
at org.apache.hadoop.ha.ZKFailoverController$1.run(ZKFailoverController.java:177)
at org.apache.hadoop.security.SecurityUtil.doAsLoginUserOrFatal(SecurityUtil.java:503)
at org.apache.hadoop.ha.ZKFailoverController.run(ZKFailoverController.java:177)
at org.apache.hadoop.ha.MiniZKFCCluster$DummyZKFCThread.doWork(MiniZKFCCluster.java:301)
at org.apache.hadoop.test.MultithreadedTestUtil$TestingThread.run(MultithreadedTestUtil.java:189){noformat}
For an easy reproduction, run the reproduce.sh in the attachment.
We are happy to provide a patch if this issue is confirmed.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: common-dev-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-dev-help@hadoop.apache.org