Hi, I'm having some problems with MQTT that disconnects from time to time. I read several topic but honestly I still don't know why this happens and I cannot figure it out. I have several control in order to check what's going on, but nothing:
This is the situation.
- I have node-red running on two raspberry. Each of them has a different MQTT client
- Clients send messages ranging from one second to one minute (depending on the topic)
- Mosquitto brocker runs on a Debian machine (TLS connection)
- On the Debian machine, another node-red instance received MQTT messages and process them. Here I can even check the birth/will/close msg related to the client on the pi.
I have three kind of problems, I don't know if they are all related each others. These situations don't happen regularly and not all together or in the same order:
-
The client on the raspberry closes its connection, without any apparent reason
2023-04-17 16:12:16: Client Local_2 closed its connection
--> brocker's log
However node-red is still runnng and on its log I don't see any trace related to the mqtt node. What is strange is that in this situation node-red still display the MQTT node as connected. I can confirm it even because I've put a status node with a function node saving the status as context. And if I check it, it's connected. But, since MQTT settings has birth,will, and close messages, node-red running on Debian receives the close message of this client -
The broker close the client connection (raspberry client)
2023-04-17 14:11:40: Client Local_2 has exceeded timeout, disconnecting
--> brocker's log
in this situation, I can see on node-red log the MQTT node activities, but I don't understand why this happens
17 Apr 14:52:04 - [info] [mqtt-broker:Client] Disconnected from broker: Local_2@mqtts://www.example.comt:12345
17 Apr 14:52:20 - [info] [mqtt-broker:Client] Connected to broker: Local_2@mqtts://www.example.comt:12345`
- On the raspberry, node-red after some notification like this one
(node:5151) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 1001 drain listeners added to [TLSSocket]. Use emitter.setMaxListeners() to increase limit
stop running exiting with fatal error
<--- Last few GCs --->
[5151:0x4d0cee0] 63827198 ms: Mark-sweep (reduce) 318.7 (360.6) -> 318.7 (352.8) MB, 195.2 / 0.1 ms (average mu = 0.993, current mu = 0.001) external memory pressure GC in old space requested
[5151:0x4d0cee0] 63827408 ms: Mark-sweep (reduce) 318.7 (352.8) -> 318.6 (352.3) MB, 210.3 / 0.1 ms (average mu = 0.984, current mu = 0.001) external memory pressure GC in old space requested
<--- JS stacktrace --->
FATAL ERROR: v8::ArrayBuffer::NewBackingStore Allocation failed - process out of memory
nodered.service: Main process exited, code=killed, status=6/ABRT
nodered.service: Failed with result 'signal'.
This is client configuration on the pi