### What happened?
after starting the Zigbee2MQTT addon for HA, it starts an…d opens socket successfully.
in log messages (INFO) indicate the successful start. usually within a few minutes, sometimes 30 minutes, it crashes
happens with:
- both with Zigbee2MQTT and Zigbee2MQTT Edge
- port: both with hardcoded IP and local dns name
below a snippet of the debug log. as you can see, it runs normally (first timestamp 13:04:39 about skipping discovery, then crashes 2 minutes later:
```
**[2024-09-30 13:04:39]** debug: z2m: Skipping discovery of 'sensor/0xa4c13878fc15b22e/linkquality/config', already discovered
**[2024-09-30 13:06:50]** debug: zh:zstack:unpi:parser: <-- [254,35,68,129,0,0,0,0,253,197,1,1,0,160,0,12,214,156,0,0,15,8,33,10,1,0,32,80,226,255,32,55,228,255,32,0,253,197,29,113]
[2024-09-30 13:06:50] debug: zh:zstack:unpi:parser: --- parseNext [254,35,68,129,0,0,0,0,253,197,1,1,0,160,0,12,214,156,0,0,15,8,33,10,1,0,32,80,226,255,32,55,228,255,32,0,253,197,29,113]
[2024-09-30 13:06:50] debug: zh:zstack:unpi:parser: --> parsed 35 - 2 - 4 - 129 - [0,0,0,0,253,197,1,1,0,160,0,12,214,156,0,0,15,8,33,10,1,0,32,80,226,255,32,55,228,255,32,0,253,197,29] - 113
[2024-09-30 13:06:50] debug: zh:zstack:znp: AREQ: <-- AF - incomingMsg - {"groupid":0,"clusterid":0,"srcaddr":50685,"srcendpoint":1,"dstendpoint":1,"wasbroadcast":0,"linkquality":160,"securityuse":0,"timestamp":10278412,"transseqnumber":0,"len":15,"data":{"type":"Buffer","data":[8,33,10,1,0,32,80,226,255,32,55,228,255,32,0]}}
[2024-09-30 13:06:50] debug: zh:controller: Received payload: clusterID=0, address=50685, groupID=0, endpoint=1, destinationEndpoint=1, wasBroadcast=false, linkQuality=160, frame={"header":{"frameControl":{"frameType":0,"manufacturerSpecific":false,"direction":1,"disableDefaultResponse":false,"reservedBits":0},"transactionSequenceNumber":33,"commandIdentifier":10},"payload":[{"attrId":1,"dataType":32,"attrData":80},{"attrId":65506,"dataType":32,"attrData":55},{"attrId":65508,"dataType":32,"attrData":0}],"command":{"ID":10,"name":"report","parameters":[{"name":"attrId","type":33},{"name":"dataType","type":32},{"name":"attrData","type":1000}]}}
[2024-09-30 13:06:50] debug: zh:controller:endpoint: ZCL command 0xa4c138997ce5df3d/1 genBasic.defaultRsp({"cmdId":10,"statusCode":0}, {"timeout":10000,"disableResponse":false,"disableRecovery":false,"disableDefaultResponse":true,"direction":1,"reservedBits":0,"transactionSequenceNumber":33,"writeUndiv":false})
[2024-09-30 13:06:50] debug: zh:zstack: sendZclFrameToEndpointInternal 0xa4c138997ce5df3d:50685/1 (0,0,1)
[2024-09-30 13:06:50] debug: zh:zstack:znp: SREQ: --> AF - dataRequest - {"dstaddr":50685,"destendpoint":1,"srcendpoint":1,"clusterid":0,"transid":2,"options":0,"radius":30,"len":5,"data":{"type":"Buffer","data":[24,33,11,10,0]}}
[2024-09-30 13:06:50] debug: zh:zstack:unpi:writer: --> frame [254,15,36,1,253,197,1,1,0,0,2,0,30,5,24,33,11,10,0,51]
[2024-09-30 13:06:50] debug: zh:zstack:unpi:parser: --- parseNext []
[2024-09-30 13:06:50] debug: z2m: Received Zigbee message from 'Kantoorlamp1', type 'attributeReport', cluster 'genBasic', data '{"65506":55,"65508":0,"appVersion":80}' from endpoint 1 with groupID 0
[2024-09-30 13:06:50] debug: zh:zstack:unpi:parser: <-- [254,1,100,1,0,100]
[2024-09-30 13:06:50] debug: zh:zstack:unpi:parser: --- parseNext [254,1,100,1,0,100]
[2024-09-30 13:06:50] debug: zh:zstack:unpi:parser: --> parsed 1 - 3 - 4 - 1 - [0] - 100
[2024-09-30 13:06:50] debug: zh:zstack:znp: SRSP: <-- AF - dataRequest - {"status":0}
[2024-09-30 13:06:50] debug: zh:zstack:unpi:parser: --- parseNext []
[2024-09-30 13:06:50] debug: zh:zstack:unpi:parser: <-- [254,3,68,128,0,1,2,196]
[2024-09-30 13:06:50] debug: zh:zstack:unpi:parser: --- parseNext [254,3,68,128,0,1,2,196]
[2024-09-30 13:06:50] debug: zh:zstack:unpi:parser: --> parsed 3 - 2 - 4 - 128 - [0,1,2] - 196
[2024-09-30 13:06:50] debug: zh:zstack:znp: AREQ: <-- AF - dataConfirm - {"status":0,"endpoint":1,"transid":2}
[2024-09-30 13:06:50] debug: zh:zstack:unpi:parser: --- parseNext []
**[2024-09-30 13:07:36] info: zh:zstack:znp: Socket error**
[2024-09-30 13:07:36] info: zh:zstack:znp: Port closed
[2024-09-30 13:07:36] debug: zh:controller: Adapter disconnected
[2024-09-30 13:07:36] info: zh:zstack:znp: closing
[2024-09-30 13:07:36] error: z2m: Adapter disconnected, stopping
[2024-09-30 13:07:36] debug: z2m: Saving state to file /config/zigbee2mqtt/state.json
[2024-09-30 13:07:36] info: z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload '{"state":"offline"}'
[2024-09-30 13:07:36] info: z2m: Disconnecting from MQTT server
[2024-09-30 13:07:36] info: z2m: Stopping zigbee-herdsman...
[2024-09-30 13:07:36] debug: zh:controller:database: Writing database to '/config/zigbee2mqtt/database.db'
[2024-09-30 13:07:36] info: z2m: Stopped zigbee-herdsman
[2024-09-30 13:07:36] info: z2m: Stopped Zigbee2MQTT
WATCHDOG: Waiting 0.03333333333333333min before next start try.
Starting Zigbee2MQTT with watchdog (2000,60000,300000,900000,1800000,3600000).
[2024-09-30 13:07:38] info: z2m: Logging to console, file (filename: log.log)
[2024-09-30 13:07:38] debug: z2m: Loaded state from file /config/zigbee2mqtt/state.json
[2024-09-30 13:07:38] info: z2m: Starting Zigbee2MQTT version 1.40.1 (commit #unknown)
[2024-09-30 13:07:38] info: z2m: Starting zigbee-herdsman (0.57.3)
[2024-09-30 13:07:38] debug: z2m: Using zigbee-herdsman with settings: '"{\"network\":{\"panID\":27209,\"extendedPanID\":[221,141,6,80,38,137,160,61],\"channelList\":[11],\"networkKey\":\"HIDDEN\"},\"databasePath\":\"/config/zigbee2mqtt/database.db\",\"databaseBackupPath\":\"/config/zigbee2mqtt/database.db.backup\",\"backupPath\":\"/config/zigbee2mqtt/coordinator_backup.json\",\"serialPort\":{\"path\":\"tcp://zigbee2mqtt-slzb06.local:6638\",\"adapter\":\"zstack\"},\"adapter\":{\"concurrent\":null,\"delay\":null,\"disableLED\":false}}"'
[2024-09-30 13:07:38] debug: zh:controller: Starting with options '{"network":{"networkKeyDistribute":false,"networkKey":"HIDDEN","panID":27209,"extendedPanID":[221,141,6,80,38,137,160,61],"channelList":[11]},"serialPort":{"path":"tcp://zigbee2mqtt-slzb06.local:6638","adapter":"zstack"},"adapter":{"disableLED":false,"concurrent":null,"delay":null},"databasePath":"/config/zigbee2mqtt/database.db","databaseBackupPath":"/config/zigbee2mqtt/database.db.backup","backupPath":"/config/zigbee2mqtt/coordinator_backup.json"}'
[2024-09-30 13:07:38] info: zh:zstack:znp: Opening TCP socket with zigbee2mqtt-slzb06.local:6638
[2024-09-30 13:07:38] info: zh:zstack:znp: Socket error
[2024-09-30 13:07:38] error: z2m: Error while starting zigbee-herdsman
[2024-09-30 13:07:38] error: z2m: Failed to start zigbee
[2024-09-30 13:07:38] error: z2m: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
[2024-09-30 13:07:38] error: z2m: Exiting...
[2024-09-30 13:07:38] error: z2m: Error: Error while opening socket
at Socket.<anonymous> (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:178:24)
at Socket.emit (node:events:529:35)
at emitErrorNT (node:internal/streams/destroy:151:8)
at emitErrorCloseNT (node:internal/streams/destroy:116:3)
at processTicksAndRejections (node:internal/process/task_queues:82:21)
/app/node_modules/winston/node_modules/readable-stream/lib/_stream_writable.js:264
var er = new ERR_STREAM_WRITE_AFTER_END();
^
Error: write after end
at writeAfterEnd (/app/node_modules/winston/node_modules/readable-stream/lib/_stream_writable.js:264:12)
at DerivedLogger.Writable.write (/app/node_modules/winston/node_modules/readable-stream/lib/_stream_writable.js:300:21)
at DerivedLogger.log (/app/node_modules/winston/lib/winston/logger.js:231:12)
at Logger.log (/app/lib/util/logger.ts:189:25)
at Logger.info (/app/lib/util/logger.ts:202:14)
at Znp.onPortClose (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:108:16)
at Object.onceWrapper (node:events:632:26)
at Socket.emit (node:events:517:28)
at TCP.<anonymous> (node:net:350:12)
```
### What did you expect to happen?
the addon keeps running / not crash
### How to reproduce it (minimal and precise)
run the addon for a few minutes
### Zigbee2MQTT version
1.40.1-1
### Adapter firmware version
20240710
### Adapter
SLZB-06 - CC2652P
core firmware version: v2.3.6 (latest stable)
zigbee OTA firmware revision: 20240710 (latest stable)
### Setup
addon on home assistant, intel nuc x64 Hassio
### Debug log
[log (1).log](https://github.com/user-attachments/files/17188827/log.1.log)
[log.log](https://github.com/user-attachments/files/17188828/log.log)