buttplugio / buttplug-js

Buttplug Typescript/Javascript Client Implementation
https://buttplug.io
BSD 3-Clause "New" or "Revised" License
128 stars 18 forks source link

Bluetooth device connections causing processor spike on macOS #180

Closed qdot closed 5 years ago

qdot commented 5 years ago

STR:

  1. Start buttplug-server-gui
  2. Connect to a bluetooth device

Expected:

Things are ok

Actual:

Macbook pro tries to light itself on fire, node process shows 160% CPU utilization

qdot commented 5 years ago

Seems to only be happening with Lovense devices. Using

https://nodejs.org/en/docs/guides/simple-profiling/

Doesn't show much, but connecting to a Launch doesn't cause the spike. However, I do get

(node:62028) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 write listeners added. Use emitter.setMaxListeners() to increase limit

which is not good.

qdot commented 5 years ago

We were handling notifications completely incorrectly on all platforms, but Mac was were it really cropped up. Changed to using notification events correctly, things now work on all platforms.