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

Error while parsing to ZpiObject 'RangeError: Attempt to access memory outside buffer bounds #15724

Closed
MichaelBrunn3r opened this issue Dec 23, 2022 · 1 comment
Labels
problem Something isn't working stale Stale issues

Comments

@MichaelBrunn3r
Copy link

What happened?

I set up Zigbee2MQTT on a fresh install of Home Assistant OS on the Home Assistant Yellow using the installer. Using the default configuration with /dev/ttyAMA1 as the port, Z2M cannot connect to the adapter. That is expected because it tries to use zStack, but the built-in Silabs adapter uses ezsp.

addon config

data_path: /config/zigbee2mqtt
socat:
  enabled: true
  master: pty,raw,echo=0,link=/tmp/ttyZ2M,mode=777
  slave: tcp-listen:8485,keepalive,nodelay,reuseaddr,keepidle=1,keepintvl=1,keepcnt=5
  options: "-d -d"
  log: false
mqtt: {}
serial:
  port: /dev/ttyAMA1
zigbee_herdsman_debug: true

addon log

Zigbee2MQTT:debug 2022-12-23 22:19:54: Using zigbee-herdsman with settings: '{"adapter":{"concurrent":null,"delay":null,"disableLED":false},"backupPath":"/config/zigbee2mqtt/coordinator_backup.json","databaseBackupPath":"/config/zigbee2mqtt/database.db.backup","databasePath":"/config/zigbee2mqtt/database.db","network":{"channelList":[11],"extendedPanID":[221,221,221,221,221,221,221,221],"networkKey":"HIDDEN","panID":6754},"serialPort":{"path":"/dev/ttyAMA1"}}'
2022-12-23T21:19:54.999Z zigbee-herdsman:adapter Failed to validate path: 'Error: spawn udevadm ENOENT'
2022-12-23T21:19:55.005Z zigbee-herdsman:controller:log Starting with options '{"network":{"networkKeyDistribute":false,"networkKey":[1,3,5,7,9,11,13,15,0,2,4,6,8,10,12,13],"panID":6754,"extendedPanID":[221,221,221,221,221,221,221,221],"channelList":[11]},"serialPort":{"path":"/dev/ttyAMA1"},"databasePath":"/config/zigbee2mqtt/database.db","databaseBackupPath":"/config/zigbee2mqtt/database.db.backup","backupPath":"/config/zigbee2mqtt/coordinator_backup.json","adapter":{"disableLED":false,"concurrent":null,"delay":null}}'
2022-12-23T21:19:55.007Z zigbee-herdsman:adapter:zStack:znp:log Opening SerialPort with /dev/ttyAMA1 and {"baudRate":115200,"rtscts":false,"autoOpen":false}
2022-12-23T21:19:55.021Z zigbee-herdsman:adapter:zStack:znp:log Serialport opened
2022-12-23T21:19:55.026Z zigbee-herdsman:adapter:zStack:znp:SREQ --> SYS - ping - {"capabilities":1}
2022-12-23T21:19:55.029Z zigbee-herdsman:adapter:zStack:unpi:writer --> frame [254,0,33,1,32]
2022-12-23T21:19:55.043Z zigbee-herdsman:adapter:zStack:unpi:parser <-- [26,194,2,3,210,10,126]
2022-12-23T21:19:55.044Z zigbee-herdsman:adapter:zStack:unpi:parser --- parseNext [26,194,2,3,210,10,126]
2022-12-23T21:19:55.285Z zigbee-herdsman:adapter:zStack:znp:log Writing CC2530/CC2531 skip bootloader payload
2022-12-23T21:19:55.288Z zigbee-herdsman:adapter:zStack:unpi:writer --> buffer [239]
2022-12-23T21:19:56.292Z zigbee-herdsman:adapter:zStack:znp:SREQ --> SYS - ping - {"capabilities":1}
2022-12-23T21:19:56.295Z zigbee-herdsman:adapter:zStack:unpi:writer --> frame [254,0,33,1,32]
2022-12-23T21:19:56.546Z zigbee-herdsman:adapter:zStack:znp:log Skip bootloader for CC2652/CC1352
2022-12-23T21:19:57.005Z zigbee-herdsman:adapter:zStack:znp:SREQ --> SYS - ping - {"capabilities":1}
2022-12-23T21:19:57.007Z zigbee-herdsman:adapter:zStack:unpi:writer --> frame [254,0,33,1,32]
2022-12-23T21:20:03.014Z zigbee-herdsman:adapter:zStack:znp:SREQ --> SYS - ping - {"capabilities":1}
2022-12-23T21:20:03.015Z zigbee-herdsman:adapter:zStack:unpi:writer --> frame [254,0,33,1,32]
2022-12-23T21:20:09.020Z zigbee-herdsman:adapter:zStack:znp:SREQ --> SYS - ping - {"capabilities":1}
2022-12-23T21:20:09.021Z zigbee-herdsman:adapter:zStack:unpi:writer --> frame [254,0,33,1,32]
Zigbee2MQTT:error 2022-12-23 22:20:15: Error while starting zigbee-herdsman
Zigbee2MQTT:error 2022-12-23 22:20:15: Failed to start zigbee
Zigbee2MQTT:error 2022-12-23 22:20:15: Check https://www.zigbee2mqtt.io/guide/installation/20_zigbee2mqtt-fails-to-start.html for possible solutions
Zigbee2MQTT:error 2022-12-23 22:20:15: Exiting...
Zigbee2MQTT:error 2022-12-23 22:20:15: Error: Failed to connect to the adapter (Error: SRSP - SYS - ping after 6000ms)
    at ZStackAdapter.start (/app/node_modules/zigbee-herdsman/src/adapter/z-stack/adapter/zStackAdapter.ts:103:27)
    at Controller.start (/app/node_modules/zigbee-herdsman/src/controller/controller.ts:132:29)
    at Zigbee.start (/app/lib/zigbee.ts:58:27)
    at Controller.start (/app/lib/controller.ts:101:27)
    at start (/app/index.js:107:5)

So I configured Z2M to communicate via ezsp:

configuration.yaml

homeassistant: true
serial:
  adapter: ezsp
  baudrate: 115200
  port: /dev/ttyAMA1
mqtt:
  server: mqtt://core-mosquitto:1883
  user: addons
  password: ohgh9ooxaefaloop1yailei7Ahbop6eed2ow5ing3geth0fiGeiw4shoo8Iex5za
frontend:
  port: 8099
advanced:
  homeassistant_legacy_entity_attributes: false
  legacy_api: false
  legacy_availability_payload: false
device_options:
  legacy: false

Now the connection to the adapter works. Pairing works. MQTT and the frontend works. Home Assistant Automations work. I did not encounter any problems in my limited testing.
BUT: Now the addon log is spammed with the same zigbee-herdsman error message:

addon log

2022-12-23T21:24:46.887Z zigbee-herdsman:adapter:ezsp:uart <-- [2774b1a9902a7d38b25972857e]
2022-12-23T21:24:46.887Z zigbee-herdsman:adapter:ezsp:uart <-- DATA (2,7,0): 2774b1a9902a18b25972857e
2022-12-23T21:24:46.887Z zigbee-herdsman:adapter:ezsp:uart --> ACK  (3)
2022-12-23T21:24:46.888Z zigbee-herdsman:adapter:ezsp:uart --> [83401b7e]
2022-12-23T21:24:46.888Z zigbee-herdsman:adapter:ezsp:ezsp <== Frame: 369001c4000d0000
2022-12-23T21:24:46.893Z zigbee-herdsman:adapter:ezsp:uart Error while parsing to ZpiObject 'RangeError: Attempt to access memory outside buffer bounds
    at new NodeError (node:internal/errors:387:5)
    at boundsError (node:internal/buffer:84:11)
    at Buffer.readUInt16LE (node:internal/buffer:243:5)
    at Buffer.readUIntLE (node:internal/buffer:180:17)
    at Function.deserialize (/app/node_modules/zigbee-herdsman/src/adapter/ezsp/driver/types/basic.ts:19:67)
    at new EZSPFrameData (/app/node_modules/zigbee-herdsman/src/adapter/ezsp/driver/ezsp.ts:83:54)
    at Ezsp.onFrameReceived (/app/node_modules/zigbee-herdsman/src/adapter/ezsp/driver/ezsp.ts:294:21)
    at SerialDriver.emit (node:events:513:28)
    at SerialDriver.handleDATA (/app/node_modules/zigbee-herdsman/src/adapter/ezsp/driver/uart.ts:227:14)
    at SerialDriver.onParsed (/app/node_modules/zigbee-herdsman/src/adapter/ezsp/driver/uart.ts:174:22)'

What did you expect to happen?

In a Z2M installation on another device, using a USB adapter, the log is not spammed in the same way.
This issue does not seem to be critical, as the addon still works, but having so many error messages doesn't feel healthy.

How to reproduce it (minimal and precise)

Home Assistant

Home Assistant 2022.12.8
Supervisor 2022.11.2
Operating System 9.4
Frontend 20221213.1 - latest

Silicon Labs MGM210P

Manufacturer: Nabu Casa
Board Name: Yellow 1.2
EmberYNet version: 6.10.3.0 build 297
bootloader version: 0x2001, nodePlat: 0x04, nodeMicro: 0x18, nodePhy: 0x0f

Zigbee2MQTT version

1.28.4-1

Adapter firmware version

6.10.3.0 build 297

Adapter

Silicon Labs MGM210P

Debug log

No response

@github-actions
Copy link
Contributor

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

@github-actions github-actions bot added the stale Stale issues label Jan 23, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jan 30, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem Something isn't working stale Stale issues
Projects
None yet
Development

No branches or pull requests

1 participant