# Client Nodered closed its connection

**URL:** <https://discourse.nodered.org/t/client-nodered-closed-its-connection/85509>\
**Category:** General\
**Created:** [13 February 2024 22:26 UTC](https://discourse.nodered.org/t/client-nodered-closed-its-connection/85509 "2024-02-13T22:26:29Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ela](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Ela](https://discourse.nodered.org/u/Ela)\
**Post date:** [13 February 2024 22:26 UTC](https://discourse.nodered.org/t/client-nodered-closed-its-connection/85509/1 "2024-02-13T22:26:29Z")

</div>

Have a broker running on Azure Linux vm and nodered flows to log all the data published.  
I do see in mosquitto logs, mqtt in node loses its connection and try to connect back again with message  
'Client nodered\_a09cd9795fc40663 closed its connection.'

This broker receives 1-sec data from more than 100 topics and all data that comes across are logged locally.

Config of Mosquitto broker:  
'''  
max\_keepalive 65535  
max\_packet\_size 268435455

log\_type error  
log\_type warning  
log\_type notice  
log\_type information  
connection\_messages true

max\_queued\_messages 0  
'''

Any help is appreciated.  
Thanks,  
Ela

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [13 February 2024 23:56 UTC](https://discourse.nodered.org/t/client-nodered-closed-its-connection/85509/2 "2024-02-13T23:56:46Z")

</div>

Where is the node-red server in relation to the broker? On the same VM or remote?

A disconnect can happen with a duplicate MQTT client ID but that doesn't sound like what is happening here (the symptom would be continuous connections and disconnections).

Could be a timeout issue or even the server going to sleep. Hard to say without more detail.

---

<div class="post-metadata">

**Author:** ![Ela](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Ela](https://discourse.nodered.org/u/Ela)\
**Post date:** [14 February 2024 02:13 UTC](https://discourse.nodered.org/t/client-nodered-closed-its-connection/85509/3 "2024-02-14T02:13:07Z")

</div>

Thanks for your reply. The node-red is running on the same VM and mqtt in nodes that subscribe to topics.Please let me know what details would be helpful.

---

<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:** [14 February 2024 09:39 UTC](https://discourse.nodered.org/t/client-nodered-closed-its-connection/85509/4 "2024-02-14T09:39:31Z")

</div>

> [@Ela](#):
>
> 'Client nodered\_a09cd9795fc40663 closed its connection.'

Is node red restarting? Check the node-red log to see.

---

<div class="post-metadata">

**Author:** ![Ela](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Ela](https://discourse.nodered.org/u/Ela)\
**Post date:** [14 February 2024 18:28 UTC](https://discourse.nodered.org/t/client-nodered-closed-its-connection/85509/5 "2024-02-14T18:28:40Z")

</div>

I don't think node-red is restarting. Where can I find logs on nodered ?

---

<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:** [14 February 2024 21:18 UTC](https://discourse.nodered.org/t/client-nodered-closed-its-connection/85509/6 "2024-02-14T21:18:04Z")

</div>

> [@Ela](#):
>
> Where can I find logs on nodered

Normally they can be accessed using `journalctl -u nodered` , but whether that is the case for an Azure install I have no idea.

You could add an inject node set to fire on startup and make it do something that you can use to know that a restart has occurred, output to a file or persistent context or something similar.

After you see it close the connection does it reconnect?

---

<div class="post-metadata">

**Author:** ![Ela](https://avatars.discourse-cdn.com/v4/letter/e/a9adbd/32.png) [@Ela](https://discourse.nodered.org/u/Ela)\
**Post date:** [15 February 2024 20:44 UTC](https://discourse.nodered.org/t/client-nodered-closed-its-connection/85509/7 "2024-02-15T20:44:40Z")

</div>

_After you see it close the connection does it reconnect?_  
yes, it reconnected within a few seconds. but since I use Nodered to log live one-second data, its crucial for me to not lose any seconds of data.

I know node-red is single-threaded, so can i create mqtt subscribe node to make the connection with broker on a different port and each of the connections subscribing to different topics? will that help in load balancing?  
Thanks for your insight!

---

<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:** [15 February 2024 20:58 UTC](https://discourse.nodered.org/t/client-nodered-closed-its-connection/85509/8 "2024-02-15T20:58:03Z")

</div>

If node red is restarting then that will not fix the problem, so you need to determine whether that is the case.

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [15 February 2024 21:56 UTC](https://discourse.nodered.org/t/client-nodered-closed-its-connection/85509/9 "2024-02-15T21:56:51Z")

</div>

Please also share your MQTT config node settings. What version of MQTT are you specifying? What Keepalive? Have you specified a client ID - if so, what is it and have you tried without?

You may also need to check your broker settings to see what keepalive it is specifying.

---

<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:** [15 May 2024 21:57 UTC](https://discourse.nodered.org/t/client-nodered-closed-its-connection/85509/10 "2024-05-15T21:57:10Z")

</div>

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