diff --git a/hadoop-yarn-project/CHANGES.txt b/hadoop-yarn-project/CHANGES.txt index 06c02292ba5..aa543b74a9d 100644 --- a/hadoop-yarn-project/CHANGES.txt +++ b/hadoop-yarn-project/CHANGES.txt @@ -205,6 +205,9 @@ Release 2.6.0 - UNRELEASED YARN-2034. Description for yarn.nodemanager.localizer.cache.target-size-mb is incorrect (Chen He via jlowe) + YARN-1919. Potential NPE in EmbeddedElectorService#stop. + (Tsuyoshi Ozawa via kasha) + Release 2.5.0 - 2014-08-11 INCOMPATIBLE CHANGES diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/EmbeddedElectorService.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/EmbeddedElectorService.java index 0aa292ffbf5..c7b7768d10d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/EmbeddedElectorService.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-server/hadoop-yarn-server-resourcemanager/src/main/java/org/apache/hadoop/yarn/server/resourcemanager/EmbeddedElectorService.java @@ -109,8 +109,14 @@ public class EmbeddedElectorService extends AbstractService @Override protected void serviceStop() throws Exception { - elector.quitElection(false); - elector.terminateConnection(); + /** + * When error occurs in serviceInit(), serviceStop() can be called. + * We need null check for the case. + */ + if (elector != null) { + elector.quitElection(false); + elector.terminateConnection(); + } super.serviceStop(); }