ModbusClientTCPasync requests some registers from modbus device in 10 seconds interval.
modubs device answers requests and additional not requested responses.
every time such a non requested response is coming in the heap increases until the esp32-s3 crashes because of no more heap.
example logs with that warnings
23:15:12.362 > [V] 102618| ModbusMessage.cpp [ 473] checkData: Check data #3
23:15:12.362 > [V] Enqueue: @3FCD03F0/6:
23:15:12.362 > | 0000: 01 03 02 02 00 1C |...... |
23:15:12.363 > [D] 102619| ModbusClientTCPasync.cpp [ 396] send: request sent (msgid:27)
23:15:12.363 > [D] 102619| ModbusClientTCPasync.cpp [ 124] addRequestM: Add TCP request result: 00
23:15:12.363 > [V] 102619| ModbusMessage.cpp [ 473] checkData: Check data #3
23:15:12.364 > [V] Enqueue: @3FCCB60C/6:
23:15:12.364 > | 0000: 01 03 02 4A 00 0B |...J.. |
23:15:12.364 > [D] 102620| ModbusClientTCPasync.cpp [ 124] addRequestM: Add TCP request result: 00
23:15:12.364 > [V] 102620| ModbusMessage.cpp [ 473] checkData: Check data #3
23:15:12.364 > [V] Enqueue: @3FCCB60C/6:
23:15:12.365 > | 0000: 01 03 02 71 00 34 |...q.4 |
23:15:12.365 > [D] 102621| ModbusClientTCPasync.cpp [ 124] addRequestM: Add TCP request result: 00
23:15:12.687 > [D] 102943| ModbusClientTCPasync.cpp [ 226] onPacket: packet received (len:65)
23:15:12.687 > [D] 102943| ModbusClientTCPasync.cpp [ 231] onPacket: parsing (len:66)
23:15:12.688 > [D] 102944| ModbusClientTCPasync.cpp [ 252] onPacket: packet validated (len:59)
23:15:12.688 > [D] 102944| ModbusClientTCPasync.cpp [ 273] onPacket: matched request
23:15:12.689 > [D] 102945| ModbusClientTCPasync.cpp [ 396] send: request sent (msgid:28)
23:15:13.097 > [D] 103353| ModbusClientTCPasync.cpp [ 226] onPacket: packet received (len:31)
23:15:13.097 > [D] 103353| ModbusClientTCPasync.cpp [ 231] onPacket: parsing (len:32)
23:15:13.097 > [D] 103353| ModbusClientTCPasync.cpp [ 252] onPacket: packet validated (len:25)
23:15:13.097 > [D] 103353| ModbusClientTCPasync.cpp [ 273] onPacket: matched request
23:15:13.099 > [D] 103355| ModbusClientTCPasync.cpp [ 396] send: request sent (msgid:29)
23:15:13.609 > [D] 103865| ModbusClientTCPasync.cpp [ 226] onPacket: packet received (len:113)
23:15:13.609 > [D] 103865| ModbusClientTCPasync.cpp [ 231] onPacket: parsing (len:114)
23:15:13.610 > [D] 103866| ModbusClientTCPasync.cpp [ 252] onPacket: packet validated (len:107)
23:15:13.610 > [D] 103866| ModbusClientTCPasync.cpp [ 273] onPacket: matched request
23:15:20.874 > [D] 111130| ModbusClientTCPasync.cpp [ 226] onPacket: packet received (len:11)
23:15:20.874 > [D] 111130| ModbusClientTCPasync.cpp [ 231] onPacket: parsing (len:12)
23:15:20.874 > [D] 111130| ModbusClientTCPasync.cpp [ 252] onPacket: packet validated (len:5)
23:15:20.874 > [W] 111130| ModbusClientTCPasync.cpp [ 276] onPacket: no matching request found <<<<<<<<
23:15:21.181 > [D] 111437| ModbusClientTCPasync.cpp [ 226] onPacket: packet received (len:11)
23:15:21.181 > [D] 111437| ModbusClientTCPasync.cpp [ 231] onPacket: parsing (len:12)
23:15:21.181 > [D] 111437| ModbusClientTCPasync.cpp [ 252] onPacket: packet validated (len:5)
23:15:21.181 > [W] 111437| ModbusClientTCPasync.cpp [ 276] onPacket: no matching request found <<<<<<<<
23:15:21.590 > [D] 111846| ModbusClientTCPasync.cpp [ 226] onPacket: packet received (len:11)
23:15:21.591 > [D] 111847| ModbusClientTCPasync.cpp [ 231] onPacket: parsing (len:12)
23:15:21.591 > [D] 111847| ModbusClientTCPasync.cpp [ 252] onPacket: packet validated (len:5)
23:15:21.591 > [W] 111847| ModbusClientTCPasync.cpp [ 276] onPacket: no matching request found <<<<<<<<
|
} else { |
|
// TCP packet did not yield valid modbus response, abort function |
|
LOG_W("no matching request found\n"); |
|
return; |
a
delete response;
before the return would fix it
ModbusClientTCPasync requests some registers from modbus device in 10 seconds interval.
modubs device answers requests and additional not requested responses.
every time such a non requested response is coming in the heap increases until the esp32-s3 crashes because of no more heap.
example logs with that warnings
eModbus/src/ModbusClientTCPasync.cpp
Lines 275 to 278 in 8528ffe
a
delete response;before the return would fix it