# River module stops after nodes shutdown

**URL:** <https://discuss.elastic.co/t/river-module-stops-after-nodes-shutdown/5354>\
**Category:** Elasticsearch\
**Created:** [September 12, 2011, 9:21am UTC](https://discuss.elastic.co/t/river-module-stops-after-nodes-shutdown/5354 "2011-09-12T09:21:46Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marek\_Skorek](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@Marek\_Skorek](https://discuss.elastic.co/u/Marek_Skorek)\
**Post date:** [September 12, 2011, 9:21am UTC](https://discuss.elastic.co/t/river-module-stops-after-nodes-shutdown/5354/1 "2011-09-12T09:21:46Z")

</div>

Hi, I have created an elasticsearch river module and I have a question  
about its lifecycle.

I met a situation where cluster nodes were shut down before sending  
shutdown signal to es-plugin.  
Is there any possibility to make my plugin more aware about cluster  
state and stop it before nodes will shut down?

If the nodes shut down earlier that my plugin it will throw exceptions  
(nodes shutdown) during indexing. In that case nothing bad happens  
because data will be indexed next time, but system logs doesn't look  
well then 😉

Thanks for any helpful advice 🙂

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [September 12, 2011, 9:23am UTC](https://discuss.elastic.co/t/river-module-stops-after-nodes-shutdown/5354/2 "2011-09-12T09:23:44Z")

</div>

The close operation on the river will be called when a node shuts down. Are  
you saying you don't see it being called?

On Mon, Sep 12, 2011 at 12:21 PM, scoro [scoropl@gmail.com](mailto:scoropl@gmail.com) wrote:

> Hi, I have created an elasticsearch river module and I have a question  
> about its lifecycle.
> 
> I met a situation where cluster nodes were shut down before sending  
> shutdown signal to es-plugin.  
> Is there any possibility to make my plugin more aware about cluster  
> state and stop it before nodes will shut down?
> 
> If the nodes shut down earlier that my plugin it will throw exceptions  
> (nodes shutdown) during indexing. In that case nothing bad happens  
> because data will be indexed next time, but system logs doesn't look  
> well then 😉
> 
> Thanks for any helpful advice 🙂

---

<div class="post-metadata">

**Author:** ![Marek\_Skorek](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@Marek\_Skorek](https://discuss.elastic.co/u/Marek_Skorek)\
**Post date:** [September 12, 2011, 6:17pm UTC](https://discuss.elastic.co/t/river-module-stops-after-nodes-shutdown/5354/3 "2011-09-12T18:17:56Z")

</div>

Hey Shay,

I see it being called. I just mean I can't index documents in the  
interval between shards shutdown and closing river plugin.  
I made a mistake and wrote "nodes" instead of "shards" 🙂

On 12 Wrz, 11:23, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> The close operation on the river will be called when a node shuts down. Are  
> you saying you don't see it being called?
> 
> On Mon, Sep 12, 2011 at 12:21 PM, scoro [scor...@gmail.com](mailto:scor...@gmail.com) wrote:
> 
> > Hi, I have created an elasticsearch river module and I have a question  
> > about its lifecycle.
> 
> > I met a situation where cluster nodes were shut down before sending  
> > shutdown signal to es-plugin.  
> > Is there any possibility to make my plugin more aware about cluster  
> > state and stop it before nodes will shut down?
> 
> > If the nodes shut down earlier that my plugin it will throw exceptions  
> > (nodes shutdown) during indexing. In that case nothing bad happens  
> > because data will be indexed next time, but system logs doesn't look  
> > well then 😉
> 
> > Thanks for any helpful advice 🙂

---

<div class="post-metadata">

**Author:** ![kimchy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kimchy/32/44952_2.png) [@kimchy](https://discuss.elastic.co/u/kimchy)\
**Post date:** [September 12, 2011, 11:00pm UTC](https://discuss.elastic.co/t/river-module-stops-after-nodes-shutdown/5354/4 "2011-09-12T23:00:05Z")

</div>

Ahh, yes, you can't index docs when it happens because the rivers will be  
closed after other services are closed / stopped. It might make sense to  
move this and close the rivers first, allowing one to still operate while  
being closed, opened an issue:  
[Rivers: Close rivers early allowing them to still do index operations · Issue #1330 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1330).

On Mon, Sep 12, 2011 at 9:17 PM, scoro [scoropl@gmail.com](mailto:scoropl@gmail.com) wrote:

> Hey Shay,
> 
> I see it being called. I just mean I can't index documents in the  
> interval between shards shutdown and closing river plugin.  
> I made a mistake and wrote "nodes" instead of "shards" 🙂
> 
> On 12 Wrz, 11:23, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> 
> > The close operation on the river will be called when a node shuts down.  
> > Are  
> > you saying you don't see it being called?
> > 
> > On Mon, Sep 12, 2011 at 12:21 PM, scoro [scor...@gmail.com](mailto:scor...@gmail.com) wrote:
> > 
> > > Hi, I have created an elasticsearch river module and I have a question  
> > > about its lifecycle.
> > 
> > > I met a situation where cluster nodes were shut down before sending  
> > > shutdown signal to es-plugin.  
> > > Is there any possibility to make my plugin more aware about cluster  
> > > state and stop it before nodes will shut down?
> > 
> > > If the nodes shut down earlier that my plugin it will throw exceptions  
> > > (nodes shutdown) during indexing. In that case nothing bad happens  
> > > because data will be indexed next time, but system logs doesn't look  
> > > well then 😉
> > 
> > > Thanks for any helpful advice 🙂

---

<div class="post-metadata">

**Author:** ![Marek\_Skorek](https://avatars.discourse-cdn.com/v4/letter/m/74df32/32.png) [@Marek\_Skorek](https://discuss.elastic.co/u/Marek_Skorek)\
**Post date:** [September 13, 2011, 7:42am UTC](https://discuss.elastic.co/t/river-module-stops-after-nodes-shutdown/5354/5 "2011-09-13T07:42:21Z")

</div>

Thank you Shay 😉

I guess that should help and I will not be concerned about checking  
for ability to index my documents after STOP signal 🙂

On 13 Wrz, 01:00, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:

> Ahh, yes, you can't index docs when it happens because the rivers will be  
> closed after other services are closed / stopped. It might make sense to  
> move this and close the rivers first, allowing one to still operate while  
> being closed, opened an issue:[Rivers: Close rivers early allowing them to still do index operations · Issue #1330 · elastic/elasticsearch · GitHub](https://github.com/elasticsearch/elasticsearch/issues/1330.On) Mon, Sep 12, 2011 at 9:17 PM, scoro [scor...@gmail.com](mailto:scor...@gmail.com) wrote:
> 
> > Hey Shay,
> 
> > I see it being called. I just mean I can't index documents in the  
> > interval between shards shutdown and closing river plugin.  
> > I made a mistake and wrote "nodes" instead of "shards" 🙂
> 
> > On 12 Wrz, 11:23, Shay Banon [kim...@gmail.com](mailto:kim...@gmail.com) wrote:
> > 
> > > The close operation on the river will be called when a node shuts down.  
> > > Are  
> > > you saying you don't see it being called?
> 
> > > On Mon, Sep 12, 2011 at 12:21 PM, scoro [scor...@gmail.com](mailto:scor...@gmail.com) wrote:
> > > 
> > > > Hi, I have created an elasticsearch river module and I have a question  
> > > > about its lifecycle.
> 
> > > > I met a situation where cluster nodes were shut down before sending  
> > > > shutdown signal to es-plugin.  
> > > > Is there any possibility to make my plugin more aware about cluster  
> > > > state and stop it before nodes will shut down?
> 
> > > > If the nodes shut down earlier that my plugin it will throw exceptions  
> > > > (nodes shutdown) during indexing. In that case nothing bad happens  
> > > > because data will be indexed next time, but system logs doesn't look  
> > > > well then 😉
> 
> > > > Thanks for any helpful advice 🙂

---

<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 6, 2017, 3:54am UTC](https://discuss.elastic.co/t/river-module-stops-after-nodes-shutdown/5354/6 "2017-07-06T03:54:35Z")

</div>


