# ES 5.1 - Shard recovery stuck in INIT- IndexShardRelocatedException: Already relocated

**URL:** <https://discuss.elastic.co/t/es-5-1-shard-recovery-stuck-in-init-indexshardrelocatedexception-already-relocated/102782>\
**Category:** Elasticsearch\
**Created:** [October 5, 2017, 1:35am UTC](https://discuss.elastic.co/t/es-5-1-shard-recovery-stuck-in-init-indexshardrelocatedexception-already-relocated/102782 "2017-10-05T01:35:48Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ankit\_Malpani](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ankit_malpani/32/14566_2.png) [@Ankit\_Malpani](https://discuss.elastic.co/u/Ankit_Malpani)\
**Post date:** [October 5, 2017, 1:35am UTC](https://discuss.elastic.co/t/es-5-1-shard-recovery-stuck-in-init-indexshardrelocatedexception-already-relocated/102782/1 "2017-10-05T01:35:48Z")

</div>

So I had a shard peer recovery stuck on ES 5.1 for 16 hours.

- \_recovery APIs showed this stuck on INIT state
- shards themselves were small ~3 MB
- Had plenty free space on source and destination nodes
- I noticed that both source and destination nodes invovled in the peer recovery had the segment/lucene files which shows part of recovery process did succeed
- On enabling TRACE I am pretty sure this is a bug as after enabling TRACE logs, i could figure that the source node trying to relocate its shard to a destination was constantly trying and getting error of the form

[2017-10-04T17:45:47,586][TRACE][o.e.i.r.PeerRecoveryTargetService] [wb\_dtDf] [logs1][3] Got exception on recovery  
org.elasticsearch.transport.RemoteTransportException: [qx\_Ng9r][x.x.x.x:9300][internal:index/shard/recovery/start\_recovery]  
Caused by: org.elasticsearch.index.shard.IndexShardRelocatedException: CurrentState[RELOCATED] Already relocated  
at org.elasticsearch.indices.recovery.RecoverySourceHandler.recoverToTarget(RecoverySourceHandler.java:162) ~[elasticsearch-5.1.1.jar:5.1.1]  
at org.elasticsearch.indices.recovery.PeerRecoverySourceService.recover(PeerRecoverySourceService.java:119) ~[elasticsearch-5.1.1.jar:5.1.1]  
at org.elasticsearch.indices.recovery.PeerRecoverySourceService.access$100(PeerRecoverySourceService.java:54) ~[elasticsearch-5.1.1.jar:5.1.1]  
at org.elasticsearch.indices.recovery.PeerRecoverySourceService$StartRecoveryTransportRequestHandler.messageReceived(PeerRecoverySourceService.java:128) ~[elasticsearch-5.1.1.jar:5.1.1]  
at org.elasticsearch.indices.recovery.PeerRecoverySourceService$StartRecoveryTransportRequestHandler.messageReceived(PeerRecoverySourceService.java:125) ~[elasticsearch-5.1.1.jar:5.1.1]  
at org.elasticsearch.transport.TransportRequestHandler.messageReceived(TransportRequestHandler.java:33) ~[elasticsearch-5.1.1.jar:5.1.1]  
at org.elasticsearch.transport.RequestHandlerRegistry.processMessageReceived(RequestHandlerRegistry.java:69) ~[elasticsearch-5.1.1.jar:5.1.1]  
at org.elasticsearch.transport.TcpTransport$RequestHandler.doRun(TcpTransport.java:1385) ~[elasticsearch-5.1.1.jar:5.1.1]  
at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingAbstractRunnable.doRun(ThreadContext.java:527) [elasticsearch-5.1.1.jar:5.1.1]  
at org.elasticsearch.common.util.concurrent.AbstractRunnable.run(AbstractRunnable.java:37) [elasticsearch-5.1.1.jar:5.1.1]  
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0\_112]  
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0\_112]  
at java.lang.Thread.run(Thread.java:745) [?:1.8.0\_112]

- Based on this , I realized maybe deleting the partially copied index on the destination will get the recovery to move forward which did fix my problem.

However, I think this is a bug and the recovery code should have internally tried to delete the copied contents of the shard on destination node after getting 'IndexShardRelocatedException: CurrentState[RELOCATED] Already relocated' almost every minute for 16 hours worth of attempts.

---

<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:** [October 6, 2017, 4:43am UTC](https://discuss.elastic.co/t/es-5-1-shard-recovery-stuck-in-init-indexshardrelocatedexception-already-relocated/102782/2 "2017-10-06T04:43:29Z")

</div>

> [@Ankit\_Malpani](#):
>
> However, I think this is a bug

Please raise this on Github so we can take a closer look - [Issues · elastic/elasticsearch · GitHub](https://github.com/elastic/elasticsearch/issues)

---

<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:** [November 3, 2017, 4:43am UTC](https://discuss.elastic.co/t/es-5-1-shard-recovery-stuck-in-init-indexshardrelocatedexception-already-relocated/102782/3 "2017-11-03T04:43:57Z")

</div>

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