From c78306980457135328987ab796eea62ce05b8d0e Mon Sep 17 00:00:00 2001 From: Ioannis Kakavas Date: Wed, 20 Feb 2019 15:35:35 +0200 Subject: [PATCH] Fix NPE on Stale Index in IndicesService(#39173) This is a backport of #38891 which closes #38845 --- .../main/java/org/elasticsearch/indices/IndicesService.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/src/main/java/org/elasticsearch/indices/IndicesService.java b/server/src/main/java/org/elasticsearch/indices/IndicesService.java index 2977cea2ae8..949fe9b4b2b 100644 --- a/server/src/main/java/org/elasticsearch/indices/IndicesService.java +++ b/server/src/main/java/org/elasticsearch/indices/IndicesService.java @@ -900,6 +900,9 @@ public class IndicesService extends AbstractLifecycleComponent final IndexMetaData metaData; try { metaData = metaStateService.loadIndexState(index); + if (metaData == null) { + return null; + } } catch (Exception e) { logger.warn(() -> new ParameterizedMessage("[{}] failed to load state file from a stale deleted index, " + "folders will be left on disk", index), e);