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

noble interface should be hardened. #55

Open
jeremydk opened this issue Feb 20, 2021 · 1 comment
Open

noble interface should be hardened. #55

jeremydk opened this issue Feb 20, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@jeremydk
Copy link
Contributor

I had a client device (ios) disconnect and reconnect while Gymnasticon was actively sending bike data.

Feb 20 02:19:31 gymnasticon gymnasticon[1625]: [2021-02-20T07:19:31.578Z] received stats from bike [power=62W cadence=85rpm]
Feb 20 02:19:31 gymnasticon gymnasticon[1625]: noble warning: unknown handle 64 disconnected!
Feb 20 02:19:31 gymnasticon gymnasticon[1625]: noble: unknown peripheral 742558933534 connected!
Feb 20 02:19:31 gymnasticon gymnasticon[1625]: [2021-02-20T07:19:31.761Z] received stats from bike [power=62W cadence=85rpm]
Feb 20 02:19:31 gymnasticon gymnasticon[1625]: [2021-02-20T07:19:31.861Z] received stats from bike [power=62W cadence=85rpm]
Feb 20 02:19:32 gymnasticon gymnasticon[1625]: /home/pi/workspace/gymnasticon/node_modules/@abandonware/noble/lib/noble.js:564
Feb 20 02:19:32 gymnasticon gymnasticon[1625]:   peripheral.mtu = mtu;
Feb 20 02:19:32 gymnasticon gymnasticon[1625]:                  ^
Feb 20 02:19:32 gymnasticon gymnasticon[1625]: TypeError: Cannot set property 'mtu' of undefined
Feb 20 02:19:32 gymnasticon gymnasticon[1625]:     at Noble.onMtu (/home/pi/workspace/gymnasticon/node_modules/@abandonware/noble/lib/noble.js:564:18)
Feb 20 02:19:32 gymnasticon gymnasticon[1625]:     at NobleBindings.emit (events.js:314:20)
Feb 20 02:19:32 gymnasticon gymnasticon[1625]:     at NobleBindings.onMtu (/home/pi/workspace/gymnasticon/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:277:8)
Feb 20 02:19:32 gymnasticon gymnasticon[1625]:     at Gatt.emit (events.js:314:20)
Feb 20 02:19:32 gymnasticon gymnasticon[1625]:     at Object.callback (/home/pi/workspace/gymnasticon/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:329:10)
Feb 20 02:19:32 gymnasticon gymnasticon[1625]:     at Gatt.onAclStreamData (/home/pi/workspace/gymnasticon/node_modules/@abandonware/noble/lib/hci-socket/gatt.js:133:26)
Feb 20 02:19:32 gymnasticon gymnasticon[1625]:     at AclStream.emit (events.js:326:22)
Feb 20 02:19:32 gymnasticon gymnasticon[1625]:     at AclStream.push (/home/pi/workspace/gymnasticon/node_modules/@abandonware/noble/lib/hci-socket/acl-stream.js:33:10)
Feb 20 02:19:32 gymnasticon gymnasticon[1625]:     at NobleBindings.onAclDataPkt (/home/pi/workspace/gymnasticon/node_modules/@abandonware/noble/lib/hci-socket/bindings.js:288:15)
Feb 20 02:19:32 gymnasticon gymnasticon[1625]:     at Hci.emit (events.js:314:20)

We should considering catching / retrying the bluetooth setup (assuming we have visibility at our scope) to become more durable to this. Systemd did restart the process, so this isn't a terminal case for folks.

@ptx2
Copy link
Owner

ptx2 commented Feb 20, 2021

Interesting! It looks like a race in noble where it tries to operate on a peripheral that is not in its internal list of peripherals. There is an open PR on noble abandonware/noble#165 which looks like it will prevent the TypeError from occurring.

I will keep an eye on that PR and update noble once they merge it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants