Client Nodered closed its connection

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

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.

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.

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

I don't think node-red is restarting. 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?

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!

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

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.