You are viewing a plain text version of this content. The canonical link for it is here.
Posted to common-issues@hadoop.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2023/09/11 12:53:00 UTC
[jira] [Updated] (HADOOP-18831) Missing null check when running doRun method
[ https://issues.apache.org/jira/browse/HADOOP-18831?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
ASF GitHub Bot updated HADOOP-18831:
------------------------------------
Labels: pull-request-available (was: )
> 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
> Affects Versions: 3.3.3
> Reporter: ConfX
> Priority: Critical
> Labels: pull-request-available
> Attachments: reproduce.sh
>
>
> h2. What happened?
> Got NullPointerException when running {{doRun}} method in {{{}ZKFailoverController.java{}}}.
> h2. Where's the bug?
> In line 258 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-issues-unsubscribe@hadoop.apache.org
For additional commands, e-mail: common-issues-help@hadoop.apache.org