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

Trying to lock adapter 0 even though it is already locked #327

Closed
Veldkornet opened this issue Oct 31, 2020 · 12 comments
Closed

Trying to lock adapter 0 even though it is already locked #327

Veldkornet opened this issue Oct 31, 2020 · 12 comments

Comments

@Veldkornet
Copy link

Describe the bug
Room Assistant seems to stop working after a while on an Intel NUC

To reproduce
Steps required to reproduce the issue.

Relevant logs
Log output that correlates to the bug. You can get debug output with room-assistant -v.

UnhandledPromiseRejectionWarning: Error: Trying to lock adapter 0 even though it is already locked
    at BluetoothService.lockAdapter (/usr/lib/node_modules/room-assistant/dist/integrations/bluetooth/bluetooth.service.js:107:23)
    at BluetoothService.inquireClassicRssi (/usr/lib/node_modules/room-assistant/dist/integrations/bluetooth/bluetooth.service.js:41:20)
    at BluetoothClassicService.handleRssiRequest (/usr/lib/node_modules/room-assistant/dist/integrations/bluetooth-classic/bluetooth-classic.service.js:92:52)
    at ClusterService.emit (events.js:315:20)
    at ClusterService.processEvent (/usr/lib/node_modules/room-assistant/node_modules/democracy/lib/democracy.js:372:12)
    at ClusterService.processEvent (/usr/lib/node_modules/room-assistant/dist/cluster/cluster.service.js:121:15)
    at Socket.<anonymous> (/usr/lib/node_modules/room-assistant/node_modules/democracy/lib/democracy.js:73:14)
    at Socket.emit (events.js:315:20)
    at UDP.onMessage [as onmessage] (dgram.js:910:8)
(node:187) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 810)

Relevant configuration
Paste the relevant parts of your configuration below.

Expected behavior
The error should not occur

Environment

  • room-assistant version: 2.11.2
  • installation type: Hass.io
  • hardware: NUC
  • OS: HomeAssistantOS

Additional context
Add any other context about the problem here.

@Veldkornet Veldkornet added the bug label Oct 31, 2020
@mKeRix
Copy link
Owner

mKeRix commented Oct 31, 2020

If this only occurs every now and then this is normal, in the next version the error will be handled more elegantly. Is this also the case for your report or will it not detect anything anymore and only spew this error after a while?

@Veldkornet
Copy link
Author

From what I've seen, it will not detect anything anymore and only spew this error after a while.

I noticed that my phone wasn't being detected while standing right next to the thing, so I went and had a look and found this in the logs.

Restart of the add-on fixed it.

@gadric
Copy link

gadric commented Nov 11, 2020

I have the same problem now. It shows up every hour or so (also with the newest version).

Also on Inten NUC as @Veldkornet

github-actions bot pushed a commit that referenced this issue Dec 6, 2020
# [2.13.0-beta.3](v2.13.0-beta.2...v2.13.0-beta.3) (2020-12-06)

### Bug Fixes

* **bluetooth-low-energy:** add timeout for app discovery ([16922ac](16922ac))
* **bluetooth-low-energy:** improve app id sharing ([b0b2f7c](b0b2f7c))
* limit classic inquiry lock time ([c1412cb](c1412cb)), closes [#327](#327)

### Features

* **entities:** add debounce edge options ([d5b92cf](d5b92cf)), closes [#329](#329)
* **home-assistant:** allow disabling of attribute updates ([9d2eb5b](9d2eb5b))
* **xiaomi-mi:** add device information ([#362](#362)) ([67427d5](67427d5))
@github-actions
Copy link

github-actions bot commented Dec 6, 2020

🎉 This issue has been resolved in version 2.13.0-beta.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

@mKeRix mKeRix closed this as completed in c1412cb Jan 31, 2021
github-actions bot pushed a commit that referenced this issue Jan 31, 2021
# [2.13.0](v2.12.0...v2.13.0) (2021-01-31)

### Bug Fixes

* **bluetooth:** attempt adapter reset on LE timeouts ([386ef37](386ef37))
* **bluetooth:** disallow parallel resets ([09d55bd](09d55bd))
* **bluetooth:** further improve adapter stability ([fef1a2c](fef1a2c))
* **bluetooth:** hard reset adapter on timeouts ([112441b](112441b))
* **bluetooth:** improve adapter stability ([1c99d05](1c99d05))
* **bluetooth:** improve adapter stability ([27112a0](27112a0))
* **bluetooth-low-energy:** add timeout for app discovery ([16922ac](16922ac))
* **bluetooth-low-energy:** end app discovery on disconnect ([ac2c13d](ac2c13d))
* **bluetooth-low-energy:** improve app id sharing ([b0b2f7c](b0b2f7c))
* **bluetooth-low-energy:** only disconnect from connected devices ([d54c53d](d54c53d))
* **home-assistant:** do not log binary state updates ([a96b566](a96b566))
* improve companion app detection ([4e75511](4e75511))
* limit classic inquiry lock time ([c1412cb](c1412cb)), closes [#327](#327)

### Features

* **bluetooth:** reset deadlocked Bluetooth adapters ([4cdeb24](4cdeb24))
* **bluetooth:** reset stuck Bluetooth adapters ([ab4e940](ab4e940))
* **bluetooth-low-energy:** allow iOS tracking via BLE ([17d537d](17d537d)), closes [#309](#309)
* **bluetooth-low-energy:** auto-attempt to recover scanning states ([df72629](df72629))
* **bluetooth-low-energy:** make regular lists case insensitive ([286bd22](286bd22))
* **bluetooth-low-energy:** only connect to companion app devices ([adc3f23](adc3f23))
* **bluetooth-low-energy:** share discovered apps with cluster ([188e76c](188e76c))
* **entities:** add debounce edge options ([d5b92cf](d5b92cf)), closes [#329](#329)
* **home-assistant:** add device tracker discovery ([#425](#425)) ([5e3a727](5e3a727))
* **home-assistant:** add health indicator ([2ab6e42](2ab6e42))
* **home-assistant:** allow disabling of attribute updates ([9d2eb5b](9d2eb5b))
* **logger:** add Kibana log transporter ([076df21](076df21))
* **prometheus:** add metrics ([d6a90ea](d6a90ea))
* **xiaomi-mi:** add device information ([#362](#362)) ([67427d5](67427d5))
* add toggle for heatmap ([60afaa5](60afaa5))
@github-actions
Copy link

🎉 This issue has been resolved in version 2.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@garv3
Copy link

garv3 commented Aug 4, 2021

I get this error all the time on the current version 2.18.4!

@physk
Copy link

physk commented Aug 21, 2021

I'm getting it like every 10 seconds and nothing being detected on the latest hassio addon. Even bought a new Bluetooth adaptor thinking it might be the PI but that didn't fix it either.

@mKeRix

@RNL-101
Copy link

RNL-101 commented Sep 11, 2021

I'm getting the same error on a new pi zero w ... @physk did you find a solution?

@kbrohkahn
Copy link

I'm seeing the same issue on multiple computers all running 2.18.4, mostly my Intel NUC and a few Raspberry Pi 4B's. Restarting the service / docker container always gets it working for at least 30 minutes or so, is there a way to automate this restart when the adapter locks up?

@RobertusIT
Copy link

RobertusIT commented Sep 16, 2021

Hass OS and room assistant integration
Nuc

Same error, impossible to track.


[s6-init] making user provided files available at /var/run/s6/etc...exited 0.
[s6-init] ensuring user provided files have correct perms...exited 0.
[fix-attrs.d] applying ownership & permissions fixes...
[fix-attrs.d] done.
[cont-init.d] executing container initialization scripts...
[cont-init.d] done.
[services.d] starting services
[services.d] done.
[13:39:27] INFO: Setting up Home Assistant configuration
[13:39:27] INFO: Copying room-assistant configuration from /config/room_assistant
[13:39:27] INFO: Starting room-assistant
*** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
*** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi.
*** WARNING *** Please fix your application to use the native API of Avahi!
*** WARNING *** For more information see <http://0pointer.de/blog/projects/avahi-compat.html>
9/16/2021, 1:39:28 PM - info - IntegrationsModule: Loading integrations: bluetooth-classic
9/16/2021, 1:39:28 PM - info - NestFactory: Starting Nest application...
9/16/2021, 1:39:28 PM - info - InstanceLoader: AppModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: ConfigModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: NestEmitterModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: IntegrationsModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: HttpModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: DiscoveryModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: PrometheusModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: EventsModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: ClusterModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: TerminusModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: ScheduleModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: BluetoothModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: EntitiesModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: BluetoothClassicModule dependencies initialized
9/16/2021, 1:39:28 PM - info - InstanceLoader: StatusModule dependencies initialized
9/16/2021, 1:39:28 PM - info - RoutesResolver: EntitiesController {/entities}:
9/16/2021, 1:39:28 PM - info - RouterExplorer: Mapped {/entities, GET} route
9/16/2021, 1:39:28 PM - info - RoutesResolver: StatusController {/status}:
9/16/2021, 1:39:28 PM - info - RouterExplorer: Mapped {/status, GET} route
9/16/2021, 1:39:28 PM - info - RoutesResolver: PrometheusController {/metrics}:
9/16/2021, 1:39:28 PM - info - RouterExplorer: Mapped {/metrics, GET} route
9/16/2021, 1:39:28 PM - info - ConfigService: Loading configuration from /usr/lib/node_modules/room-assistant/dist/config/definitions/default.js, config/default.json, config/local.yml (Current: /room-assistant)
9/16/2021, 1:39:28 PM - error - ClusterService: Failed to start mdns discovery (dns service error: unknown)
9/16/2021, 1:39:28 PM - info - NestApplication: Nest application successfully started
9/16/2021, 1:39:30 PM - info - ClusterService: casa has been elected as leader
9/16/2021, 1:39:38 PM - error - BluetoothClassicService: Failed to retrieve RSSI for C7:2C:80:XX:XX:XX: Trying to lock adapter 0 even though it is already locked
9/16/2021, 1:39:48 PM - error - BluetoothClassicService: Failed to retrieve RSSI for C7:2C:80:XX:XX:XX: Trying to lock adapter 0 even though it is already locked
9/16/2021, 1:40:03 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked
9/16/2021, 1:40:13 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked
9/16/2021, 1:40:23 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked
9/16/2021, 1:40:33 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked
9/16/2021, 1:40:43 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked
9/16/2021, 1:40:53 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked
9/16/2021, 1:41:03 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked
9/16/2021, 1:41:13 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked

@physk
Copy link

physk commented Sep 16, 2021 via email

@RobertusIT
Copy link

I get the feeling it is something to do with the Bluetooth stack as the docker image hasn't been rebuilt in a while so nothing has changed there it's just working out what part!

On Thu, 16 Sep 2021, 12:44 RobertusIT, @.***> wrote: Hass OS and room assistant integration Nuc Same error, impossible to track. [s6-init] making user provided files available at /var/run/s6/etc...exited 0. [s6-init] ensuring user provided files have correct perms...exited 0. [fix-attrs.d] applying ownership & permissions fixes... [fix-attrs.d] done. [cont-init.d] executing container initialization scripts... [cont-init.d] done. [services.d] starting services [services.d] done. [13:39:27] INFO: Setting up Home Assistant configuration [13:39:27] INFO: Copying room-assistant configuration from /config/room_assistant [13:39:27] INFO: Starting room-assistant *** WARNING *** The program 'node' uses the Apple Bonjour compatibility layer of Avahi. *** WARNING *** Please fix your application to use the native API of Avahi! *** WARNING *** For more information see http://0pointer.de/blog/projects/avahi-compat.html *** WARNING *** The program 'node' called 'DNSServiceRegister()' which is not supported (or only supported partially) in the Apple Bonjour compatibility layer of Avahi. *** WARNING *** Please fix your application to use the native API of Avahi! *** WARNING *** For more information see http://0pointer.de/blog/projects/avahi-compat.html 9/16/2021, 1:39:28 PM - info - IntegrationsModule: Loading integrations: bluetooth-classic 9/16/2021, 1:39:28 PM - info - NestFactory: Starting Nest application... 9/16/2021, 1:39:28 PM - info - InstanceLoader: AppModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: ConfigModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: NestEmitterModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: IntegrationsModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: HttpModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: DiscoveryModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: PrometheusModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: EventsModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: ClusterModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: TerminusModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: ScheduleModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: BluetoothModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: EntitiesModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: BluetoothClassicModule dependencies initialized 9/16/2021, 1:39:28 PM - info - InstanceLoader: StatusModule dependencies initialized 9/16/2021, 1:39:28 PM - info - RoutesResolver: EntitiesController {/entities}: 9/16/2021, 1:39:28 PM - info - RouterExplorer: Mapped {/entities, GET} route 9/16/2021, 1:39:28 PM - info - RoutesResolver: StatusController {/status}: 9/16/2021, 1:39:28 PM - info - RouterExplorer: Mapped {/status, GET} route 9/16/2021, 1:39:28 PM - info - RoutesResolver: PrometheusController {/metrics}: 9/16/2021, 1:39:28 PM - info - RouterExplorer: Mapped {/metrics, GET} route 9/16/2021, 1:39:28 PM - info - ConfigService: Loading configuration from /usr/lib/node_modules/room-assistant/dist/config/definitions/default.js, config/default.json, config/local.yml (Current: /room-assistant) 9/16/2021, 1:39:28 PM - error - ClusterService: Failed to start mdns discovery (dns service error: unknown) 9/16/2021, 1:39:28 PM - info - NestApplication: Nest application successfully started 9/16/2021, 1:39:30 PM - info - ClusterService: casa has been elected as leader 9/16/2021, 1:39:38 PM - error - BluetoothClassicService: Failed to retrieve RSSI for C7:2C:80:XX:XX:XX: Trying to lock adapter 0 even though it is already locked 9/16/2021, 1:39:48 PM - error - BluetoothClassicService: Failed to retrieve RSSI for C7:2C:80:XX:XX:XX: Trying to lock adapter 0 even though it is already locked 9/16/2021, 1:40:03 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked 9/16/2021, 1:40:13 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked 9/16/2021, 1:40:23 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked 9/16/2021, 1:40:33 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked 9/16/2021, 1:40:43 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked 9/16/2021, 1:40:53 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked 9/16/2021, 1:41:03 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked 9/16/2021, 1:41:13 PM - error - BluetoothClassicService: Failed to retrieve RSSI for 64:a2:xx:xx:xx:xx: Trying to lock adapter 0 even though it is already locked — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#327 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHXPVI4RIESIXKDGDNJOJY3UCHKAZANCNFSM4TFWITLA . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

I didn't understand, anyway I have tried to use bluetooth into NUC but also a usb CSR8510, no success.

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

No branches or pull requests

8 participants