# Guaranteed Delivery flow with fileStorage gets stuck often

**URL:** <https://discourse.nodered.org/t/guaranteed-delivery-flow-with-filestorage-gets-stuck-often/74312>\
**Category:** General\
**Created:** [28 January 2023 17:46 UTC](https://discourse.nodered.org/t/guaranteed-delivery-flow-with-filestorage-gets-stuck-often/74312 "2023-01-28T17:46:25Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jakonnode](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jakonnode](https://discourse.nodered.org/u/jakonnode)\
**Post date:** [28 January 2023 17:46 UTC](https://discourse.nodered.org/t/guaranteed-delivery-flow-with-filestorage-gets-stuck-often/74312/1 "2023-01-28T17:46:25Z")

</div>

Refer to this thread

> [@Node-red-contrib-msg-queue - Only storing not forwarding w/ active connection](https://discourse.nodered.org/t/node-red-contrib-msg-queue-only-storing-not-forwarding-w-active-connection/44274/20):
>
> Colin - You are (embarrassingly) fast in responding and I'm quite obliged. \_/\_ On limits, it is quite unambiguous on your documentation. I missed. My bad. For our IoT applications, the edge devices is in remote location and in an industrial environment where network connectivity and handling is a challenge. There are times where we have two-three days of no connectivity in which case it could be of order of few GBs(extreme case and support estimation).

Using the below flow for guaranteed delivery with FileStore backing. Over time, it gets stuck with state being "waitingForOKFail" and was never able to recover from this. This happens for no reason that I couldn't triangulate - there is no mqtt server failure.

Anyone has faced this issue before - any likely way out of this. Can this be because of file lock issue or something like that?

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/e/feef1f887f4f743422ffd8780213bbedca937284.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 January 2023 18:15 UTC](https://discourse.nodered.org/t/guaranteed-delivery-flow-with-filestorage-gets-stuck-often/74312/2 "2023-01-28T18:15:55Z")

</div>

It should not be able to get stuck. What is the mqtt complete node?  
You could install the flogger node and log the messages and see how it gets stuck.  
In the meantime you can manually release it by injecting a Fail message with an inject node.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 January 2023 18:28 UTC](https://discourse.nodered.org/t/guaranteed-delivery-flow-with-filestorage-gets-stuck-often/74312/3 "2023-01-28T18:28:54Z")

</div>

> [@Colin](#):
>
> What is the mqtt complete node?

If course it is a Complete node attached to the mqtt node.

---

<div class="post-metadata">

**Author:** ![jakonnode](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jakonnode](https://discourse.nodered.org/u/jakonnode)\
**Post date:** [28 January 2023 18:45 UTC](https://discourse.nodered.org/t/guaranteed-delivery-flow-with-filestorage-gets-stuck-often/74312/4 "2023-01-28T18:45:54Z")

</div>

I have added a floggernode to track injecting message. But not sure how this gets. After (re)deploying few times it got stuck again.

Not sure how to inject a Fail message - could you please elaborate? msg.control="FAIL" or something like that?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/7/b7014705f8dea8d77073f75f38e7aedc25971c50.png)

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 January 2023 19:23 UTC](https://discourse.nodered.org/t/guaranteed-delivery-flow-with-filestorage-gets-stuck-often/74312/5 "2023-01-28T19:23:38Z")

</div>

Use the flogger node to show what is happening at multiple places in the flow, into mqtt, out of the complete node, out of the trigger node. You don't need it at the front where you have it.

> [@jakonnode](#):
>
> how to inject a Fail message

The same message that comes out of the FAIL change node. In fact I think you can just inject anything into the front of the fail node.

---

<div class="post-metadata">

**Author:** ![jakonnode](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jakonnode](https://discourse.nodered.org/u/jakonnode)\
**Post date:** [28 January 2023 19:35 UTC](https://discourse.nodered.org/t/guaranteed-delivery-flow-with-filestorage-gets-stuck-often/74312/6 "2023-01-28T19:35:13Z")

</div>

Thanks Colin. It did release all the messages when I injected some timestamp. But I have no clue as to how that happened.  
Is it because it was waiting for either Ok or Fail - and in this case Fail (control=fail) helped move it? I saw it so? 🙂  
Awesome.  
I used the flogger to backup the messages. I will try adding another logger purely for debug to find out why it is getting stuck.  
Thanks a bunch.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [28 January 2023 20:48 UTC](https://discourse.nodered.org/t/guaranteed-delivery-flow-with-filestorage-gets-stuck-often/74312/7 "2023-01-28T20:48:48Z")

</div>

Send them into one flogger so you can see the sequence.

> [@jakonnode](#):
>
> Is it because it was waiting for either Ok or Fail

Do you actually understand how the flow is supposed to work?

---

<div class="post-metadata">

**Author:** ![jakonnode](https://avatars.discourse-cdn.com/v4/letter/j/3ec8ea/32.png) [@jakonnode](https://discourse.nodered.org/u/jakonnode)\
**Post date:** [29 January 2023 18:09 UTC](https://discourse.nodered.org/t/guaranteed-delivery-flow-with-filestorage-gets-stuck-often/74312/8 "2023-01-29T18:09:00Z")

</div>

> [@Colin](#):
>
> Send them into one flogger so you can see the sequence.

Wanted the data backup in one log file and all debug in another file so that it can be handled separately and easily with different policies.

> [@Colin](#):
>
> Do you actually understand how the flow is supposed to work?

Yes. A while back I had looked at it - I forgot some of the details. Again I looked at the subflow template (state engine) yday to understand how triggering a fail message would process the pending ones.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [29 January 2023 20:23 UTC](https://discourse.nodered.org/t/guaranteed-delivery-flow-with-filestorage-gets-stuck-often/74312/9 "2023-01-29T20:23:15Z")

</div>

> [@jakonnode](#):
>
> to understand how triggering a fail message would process the pending ones.

Triggering a fail tells it the the previous one failed, so it tries it again, after the timeout you specified.

I am not sure what you are saying about flogger. From my point of view the purpose is to record what is happening so that you can look back and see why it got stuck. Can you export and post here the flow please, the nodes around the subflow. I want to make sure it is correct.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [30 March 2023 20:23 UTC](https://discourse.nodered.org/t/guaranteed-delivery-flow-with-filestorage-gets-stuck-often/74312/10 "2023-03-30T20:23:17Z")

</div>

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