# BulkProcessor deadlock on cluster failure

**URL:** <https://discuss.elastic.co/t/bulkprocessor-deadlock-on-cluster-failure/110526>\
**Category:** Elasticsearch\
**Created:** [December 6, 2017, 2:31pm UTC](https://discuss.elastic.co/t/bulkprocessor-deadlock-on-cluster-failure/110526 "2017-12-06T14:31:36Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![cwinkler](https://avatars.discourse-cdn.com/v4/letter/c/0ea827/32.png) [@cwinkler](https://discuss.elastic.co/u/cwinkler)\
**Post date:** [December 6, 2017, 2:31pm UTC](https://discuss.elastic.co/t/bulkprocessor-deadlock-on-cluster-failure/110526/1 "2017-12-06T14:31:36Z")

</div>

BulkProcessor goes into dead-lock situation when ES (5.5.1) cluster fails during bulk-processing.

If the bulk response gets lost due to failing cluster, the async bulk request handler gets stuck while waiting for the processing semaphore (concurrent-requests) to become available which never gets released.  
That leads to blocking all threads accessing the bulk-processor infinitely.

According to this topic: [Bulkprocessor Indexing Timeout](https://discuss.elastic.co/t/bulkprocessor-indexing-timeout/73271) there is no timeout in that case.

Is there any feasible workaround for getting a timeout to work?

See this extract from thread-dump:

```
"elasticsearch[vsldocker03_client][bulk_processor][T#1]" - Thread t@17579
java.lang.Thread.State: WAITING
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for <52f1d565> (a java.util.concurrent.Semaphore$NonfairSync)
	...
    at org.elasticsearch.action.bulk.BulkRequestHandler$AsyncBulkRequestHandler.execute(BulkRequestHandler.java:121)
	...
    at org.elasticsearch.action.bulk.BulkProcessor$Flush.run(BulkProcessor.java:380)
    - locked < ***51ea5713*** > (a org.elasticsearch.action.bulk.BulkProcessor)

"XXX_Worker-7" - Thread t@290
java.lang.Thread.State: BLOCKED
    at org.elasticsearch.action.bulk.BulkProcessor.internalAdd(BulkProcessor.java:287)
    - waiting to lock < ***51ea5713*** > (a org.elasticsearch.action.bulk.BulkProcessor) owned by "elasticsearch[vsldocker03_client][bulk_processor][T#1]" t@17579
    at org.elasticsearch.action.bulk.BulkProcessor.add(BulkProcessor.java:272)
```

---

<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:** [January 3, 2018, 2:31pm UTC](https://discuss.elastic.co/t/bulkprocessor-deadlock-on-cluster-failure/110526/2 "2018-01-03T14:31:42Z")

</div>

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