From 74876811c2b17a89bf2bbf70bdd250040b1f7056 Mon Sep 17 00:00:00 2001 From: Jake Landis Date: Mon, 7 Oct 2019 15:45:45 -0500 Subject: [PATCH] Watcher - catch uncaught exception. (#47680) (#47695) If a thread pool rejection exception happens, an alternative code path is chosen to write history and delete the trigger. If an exception happens during deletion of the trigger an exception may be thrown and not caught. This commit catches the exception and provides a meaning error message. fixes #47008 --- .../xpack/watcher/execution/ExecutionService.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java index e99571dd290..5ca4d14385b 100644 --- a/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java +++ b/x-pack/plugin/watcher/src/main/java/org/elasticsearch/xpack/watcher/execution/ExecutionService.java @@ -436,7 +436,14 @@ public class ExecutionService { "Error storing watch history record for watch [{}] after thread pool rejection", triggeredWatch.id()), exc); } - deleteTrigger(triggeredWatch.id()); + try { + deleteTrigger(triggeredWatch.id()); + } catch (Exception exc) { + logger.error((Supplier) () -> + new ParameterizedMessage( + "Error deleting entry from .triggered_watches for watch [{}] after thread pool rejection", + triggeredWatch.id()), exc); + } })); } }