diff --git a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/Exporters.java b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/Exporters.java index 1b8f5dab9e356..b30ec11784702 100644 --- a/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/Exporters.java +++ b/x-pack/plugin/monitoring/src/main/java/org/elasticsearch/xpack/monitoring/exporter/Exporters.java @@ -68,8 +68,13 @@ public Exporters(Settings settings, Map factories, private void setExportersSetting(Settings exportersSetting) { if (this.lifecycle.started()) { - Map updated = initExporters(exportersSetting); - closeExporters(logger, this.exporters.getAndSet(updated)); + try { + Map updated = initExporters(exportersSetting); + closeExporters(logger, this.exporters.getAndSet(updated)); + }catch (Exception e){ + //swallow exception here since this can be called from cluster state applier + logger.error("Unable set monitoring exporter settings", e); + } } } diff --git a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java index ecb0d637f14fb..50dc2c5fc1031 100644 --- a/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java +++ b/x-pack/plugin/monitoring/src/test/java/org/elasticsearch/xpack/monitoring/exporter/http/HttpExporterIT.java @@ -401,6 +401,12 @@ public void testDynamicIndexFormatChange() throws Exception { assertThat(newIndex.get("_index"), equalTo(expectedMonitoringIndex)); } + public void testInvalidConfig() { + //bad config could result in cluster state not applying properly see: https://github.com/elastic/elasticsearch/issues/47125 + client().admin().cluster().prepareUpdateSettings() + .setTransientSettings(Collections.singletonMap("xpack.monitoring.exporters.foo.use_ingest", true)).execute().actionGet(5000); + } + private void assertMonitorVersion(final MockWebServer webServer) throws Exception { assertMonitorVersion(webServer, null, null); }