# Failed to execute watch - Timeout waiting for task

**URL:** https://discuss.elastic.co/t/failed-to-execute-watch-timeout-waiting-for-task/280256
**Category:** Elasticsearch
**Created:** [August 2, 2021, 7:40pm UTC](https://discuss.elastic.co/t/failed-to-execute-watch-timeout-waiting-for-task/280256 "2021-08-02T19:40:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Brandon\_Sollins](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_sollins/32/92446_2.png) [@Brandon\_Sollins](https://discuss.elastic.co/u/Brandon_Sollins)
#### Post date: [August 2, 2021, 7:40pm UTC](https://discuss.elastic.co/t/failed-to-execute-watch-timeout-waiting-for-task/280256/1 "2021-08-02T19:40:06Z")

</div>

I am noticing random watch timeouts on my cluster that is returning the following traceback:

```auto
[2021-07-31T05:08:11,951][DEBUG][o.e.x.w.e.ExecutionService] failed to execute watch [<INSERT RANDOM WATCHER HERE>]
org.elasticsearch.ElasticsearchTimeoutException: java.util.concurrent.TimeoutException: Timeout waiting for task.
	at org.elasticsearch.common.util.concurrent.FutureUtils.get(FutureUtils.java:78) ~[elasticsearch-7.10.1.jar:7.10.1]
	at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:61) ~[elasticsearch-7.10.1.jar:7.10.1]
	at org.elasticsearch.action.support.AdapterActionFuture.actionGet(AdapterActionFuture.java:55) ~[elasticsearch-7.10.1.jar:7.10.1]
	at org.elasticsearch.xpack.watcher.execution.ExecutionService.updateWatchStatus(ExecutionService.java:380) [x-pack-watcher-7.10.1.jar:7.10.1]
	at org.elasticsearch.xpack.watcher.execution.ExecutionService.execute(ExecutionService.java:321) [x-pack-watcher-7.10.1.jar:7.10.1]
	at org.elasticsearch.xpack.watcher.execution.ExecutionService.lambda$executeAsync$5(ExecutionService.java:420) [x-pack-watcher-7.10.1.jar:7.10.1]
	at org.elasticsearch.xpack.watcher.execution.ExecutionService$WatchExecutionTask.run(ExecutionService.java:626) [x-pack-watcher-7.10.1.jar:7.10.1]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:678) [elasticsearch-7.10.1.jar:7.10.1]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1130) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:630) [?:?]
	at java.lang.Thread.run(Thread.java:832) [?:?]
Caused by: java.util.concurrent.TimeoutException: Timeout waiting for task.
	at org.elasticsearch.common.util.concurrent.BaseFuture$Sync.get(BaseFuture.java:243) ~[elasticsearch-7.10.1.jar:7.10.1]
	at org.elasticsearch.common.util.concurrent.BaseFuture.get(BaseFuture.java:65) ~[elasticsearch-7.10.1.jar:7.10.1]
	at org.elasticsearch.common.util.concurrent.FutureUtils.get(FutureUtils.java:76) ~[elasticsearch-7.10.1.jar:7.10.1]
	... 10 more

```

I think the key part is that its failing on:

```auto
org.elasticsearch.xpack.watcher.execution.ExecutionService.updateWatchStatus(ExecutionService.java:380) [x-pack-watcher-7.10.1.jar:7.10.1]

```

Which in the source code equates to:

`client.update(updateRequest).actionGet(indexDefaultTimeout);`

I assume it is trying to update the .watches document and is taking a long time, but I am not 100% sure. Has anyone seen this error before, and if so any way to resolve? The watchers are running on cool nodes, and the cluster is pretty big but load doesnt seem to get too high on these nodes.

---

<div class="post-metadata">

### Author: ![Brandon\_Sollins](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/brandon_sollins/32/92446_2.png) [@Brandon\_Sollins](https://discuss.elastic.co/u/Brandon_Sollins)
#### Post date: [August 16, 2021, 6:22pm UTC](https://discuss.elastic.co/t/failed-to-execute-watch-timeout-waiting-for-task/280256/2 "2021-08-16T18:22:37Z")

</div>

Just leaving this here in case it helps someone out in the future - this seems like it is most likely due to the nodes being too busy to execute in a timely manner. Throughout the day there is a fair amount of rollover occurring from the warm -\> cool nodes, and after adjusting some of the rebalancing settings to be more conservative (specifically cluster.routing.allocation.cluster\_concurrent\_rebalance, cluster.routing.allocation.node\_concurrent\_recoveries, cluster.routing.allocation.node\_initial\_primaries\_recoveries, and indices.recovery.max\_bytes\_per\_sec), the failures appear to be occurring less frequently / not at all.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [September 13, 2021, 6:23pm UTC](https://discuss.elastic.co/t/failed-to-execute-watch-timeout-waiting-for-task/280256/3 "2021-09-13T18:23:18Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
