Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

z2m: Error: Error while opening socket #644

Closed
magiva opened this issue Oct 9, 2024 · 8 comments
Closed

z2m: Error: Error while opening socket #644

magiva opened this issue Oct 9, 2024 · 8 comments
Labels

Comments

@magiva
Copy link

magiva commented Oct 9, 2024

Description of the issue

addon wont start
it Was running, i added the first device and now it wont start

Addon version

1.40.2-1

Platform

Core 2024.10.1
Supervisor 2024.10.0
Operating System 13.1
Frontend 20241002.2

Logs of the issue (if applicable)

[16:39:59] INFO: Preparing to start...
[16:40:00] INFO: Socat not enabled
[16:40:00] INFO: Starting Zigbee2MQTT...
Starting Zigbee2MQTT without watchdog.
[2024-10-09 16:40:02] info: z2m: Logging to console, file (filename: log.log)
[2024-10-09 16:40:02] info: z2m: Starting Zigbee2MQTT version 1.40.2 (commit #unknown)
[2024-10-09 16:40:02] info: z2m: Starting zigbee-herdsman (2.1.3)
[2024-10-09 16:40:02] info: zh:zstack:znp: Opening TCP socket with slzb-06.local:6638
[2024-10-09 16:40:02] info: zh:zstack:znp: Socket connected
[2024-10-09 16:40:02] info: zh:zstack:znp: Socket ready
[2024-10-09 16:40:02] info: zh:zstack:znp: Writing CC2530/CC2531 skip bootloader payload
[2024-10-09 16:40:02] info: zh:zstack:znp: Socket error
[2024-10-09 16:40:02] error: z2m: Error while starting zigbee-herdsman
[2024-10-09 16:40:02] error: z2m: Failed to start zigbee
[2024-10-09 16:40:02] error: z2m: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
[2024-10-09 16:40:02] error: z2m: Exiting...
[2024-10-09 16:40:02] error: z2m: Error: Error while opening socket
at Socket. (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:166: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:198:25)
at Logger.info (/app/lib/util/logger.ts:211:14)
at Znp.onPortClose (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/znp/znp.ts:96:16)
at Object.onceWrapper (node:events:632:26)
at Socket.emit (node:events:517:28)
at TCP. (node:net:350:12)

@indexample
Copy link

having the same issue,

technically, the error message seems like an issue with async in NodeJS
https://stackoverflow.com/questions/27769842/write-after-end-error-in-node-js-webserver

i have a similar issue running here, maybe i chose the wrong repo (zigbee2mqtt vs hassio-zigbee2mqtt):
Koenkk/zigbee2mqtt#24154 (comment)

@Koenkk
Copy link
Contributor

Koenkk commented Oct 18, 2024

The real error is [2024-10-09 16:40:02] info: zh:zstack:znp: Socket error, meaning it cannot connect to the dongle, I've extended the error logging a bit, can you see what is logged now?

Changes will be available in the dev branch in a few hours from now.

@indexample
Copy link

indexample commented Oct 23, 2024

i have tried with the dev branch / edge
it runs for about 5 and a half minutes, then: Socket error Error: read ECONNRESET


[2024-10-23 08:59:55] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/Kantoorlamp1', payload '{"backlight_mode":"inverted","linkquality":167,"power_on_behavior":"previous","state":"ON"}'
[2024-10-23 09:04:02] error: 	zh:zstack:znp: Socket error Error: read ECONNRESET
[2024-10-23 09:04:02] info: 	zh:zstack:znp: Port closed
[2024-10-23 09:04:02] info: 	zh:zstack:znp: closing
[2024-10-23 09:04:02] error: 	z2m: Adapter disconnected, stopping
[2024-10-23 09:04:02] info: 	z2m:mqtt: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload '{"state":"offline"}'
[2024-10-23 09:04:02] info: 	z2m: Disconnecting from MQTT server
[2024-10-23 09:04:02] info: 	z2m: Stopping zigbee-herdsman...
[2024-10-23 09:04:02] info: 	z2m: Stopped zigbee-herdsman
[2024-10-23 09:04:02] info: 	z2m: Stopped Zigbee2MQTT

@Koenkk
Copy link
Contributor

Koenkk commented Oct 23, 2024

That indicates your network connection is not stable

@indexample
Copy link

Any test you recommend that would convince you the network is stable?

Im running quite a large setup and this is the only one with issues

@Koenkk
Copy link
Contributor

Koenkk commented Oct 29, 2024

It could also be an issue of the coordinator itself, in the past I read people having these issues when opening the web page of the coordinator.

@indexample
Copy link

indexample commented Oct 30, 2024

i think i worked it out, and if so, it was a network issue indeed.

after diving into it more, there was a warning in my unify switch portal:
Multiple devices are using the same IP address: 192.168.2.X. Please check each device's configuration to ensure none are communicating with a rogue DHCP server.

the coordinator had hardcoded ip/dhcp settings, and the same static lease from router, but with different MAC address. For some reason the coordinator had gotten a different mac address over time (should these not be stable per device?!), which i believe would be the cause for this issue (in combination with the settings).

now, after changing the coordinator to dhcp settings, the addon has been running well for over 1hr.

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants