# Stuck pending tasks

**URL:** <https://discuss.elastic.co/t/stuck-pending-tasks/43541>\
**Category:** Elasticsearch\
**Created:** [March 4, 2016, 5:46pm UTC](https://discuss.elastic.co/t/stuck-pending-tasks/43541 "2016-03-04T17:46:13Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jasonw](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@jasonw](https://discuss.elastic.co/u/jasonw)\
**Post date:** [March 4, 2016, 5:46pm UTC](https://discuss.elastic.co/t/stuck-pending-tasks/43541/1 "2016-03-04T17:46:13Z")

</div>

About 10 minutes after setting `cluster.routing.allocation.disk.threshold_enabled` to `true`, over 4,000 tasks (see below for example) got queued up and they seem to be stuck. About once every 30 minutes the top 1 or 2 tasks would be removed.

Any idea why these tasks are queued up?

Thanks!

Cluster Status:

```
{
cluster_name: "search",
status: "yellow",
timed_out: false,
number_of_nodes: 6,
number_of_data_nodes: 6,
active_primary_shards: 54110,
active_shards: 162326,
relocating_shards: 500,
initializing_shards: 0,
unassigned_shards: 4
}

```

Task queued up:

```
{
insert_order: 204469,
priority: "URGENT",
source: "shard-started ([c52352ec-7d62-436e-9f74-3e4d3aa0a344][4], node[_kuf5-IYQLKA3YXo9fs_DQ], relocating [XaH-gPDTQRWjdP09dfIuqw], [P], s[INITIALIZING]), reason [after recovery (replica) from node [[Some_Node][XaH-gPDTQRWjdPZJauIuqw][inet[/10.0.xxx.xx:9300]]]]",
time_in_queue_millis: 10555125,
time_in_queue: "2.9h"
}
```

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [March 4, 2016, 6:11pm UTC](https://discuss.elastic.co/t/stuck-pending-tasks/43541/2 "2016-03-04T18:11:48Z")

</div>

> [@jasonw](#):
>
> active\_primary\_shards: 54110,  
> active\_shards: 162326

That is a VERY large number of shards for a 6 node cluster. I would recommend you reconsider your indexing/sharding strategy to reduce the number of indices and shards considerably.

How much data do you have in the cluster? What is your average shard size?

---

<div class="post-metadata">

**Author:** ![jasonw](https://avatars.discourse-cdn.com/v4/letter/j/e47c2d/32.png) [@jasonw](https://discuss.elastic.co/u/jasonw)\
**Post date:** [March 4, 2016, 6:30pm UTC](https://discuss.elastic.co/t/stuck-pending-tasks/43541/3 "2016-03-04T18:30:23Z")

</div>

@Christian_Dahlqvist: You are absolutely right. We are in the process of re-architecting our data models now. We actually have a lot of empty shards. Our total data size is only 3.2GB for this cluster.

Any idea how we can get the stuck tasks moved forward?

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [March 4, 2016, 11:56pm UTC](https://discuss.elastic.co/t/stuck-pending-tasks/43541/4 "2016-03-04T23:56:27Z")

</div>

Wow, you just broke the record for the most number of shards I have seen 😉

(On a cluster that small)

---

<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:** [July 5, 2017, 11:11pm UTC](https://discuss.elastic.co/t/stuck-pending-tasks/43541/5 "2017-07-05T23:11:02Z")

</div>


