New issue
Advanced search Search tips

Issue 659443 link

Starred by 1 user

Issue metadata

Status: WontFix
Owner: ----
Closed: Nov 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 510287



Sign in to add a comment

bluetooth: Web Page stops receiving notifications

Project Member Reported by ortuno@chromium.org, Oct 26 2016

Issue description

From external developer:

We are seeing the same that might be the same or related to this bug, where we are running Zephyr on a arduino 101, that registers a couple BLE Gatt services, where one of the service allows client running Android device to subscribe to temperature updates.  We wrote our web page that uses the BLE api to connect to the device, and then monitors the updates, the device sends 1 notifcation every 0.5 second, and the bug we are seeing is that after 5-10 mins or maybe sometimes sooner, we will stop receiving notification.   We can tell that it's a Chromium bug because we use another Android app like nrfConnect or nrfToolbox and subscribe to the same service, and we cannot reproduce this, and we've verified that the device is continuing to push out notifcation over BLE, but the phone running Android has stopped receiving them.  As a work-around, we've modified our code to only send notifications if it changed in a certain threshold, and we put a gap of at least 2 seconds between notifcations.  Here's the link to github issue we've filed to track this in our project that might be helpful to reproduce, but it will require you to get a Arduino 101 board since we are running Zephyr on the device.

https://github.com/01org/zephyr.js/issues/148

Environment Setup:
Phone: Nexus 5x
OS: Android 7.0
Chromium Version: 53.0.2785.124

There are a couple of possibilities here:

1. The device got garbage collected and the connection was dropped.
2. zephyr.js is reusing the services and characteristics from the first connection. Per spec these are no longer valid. I'm working on a patch to throw an error when this happens.
3. There is a problem in our implementation.

To rule out 1. could you please try to reproduce on the latest Chrome Dev? In the latest version a characteristic holds a reference to its services which holds a reference to its device which means the device will not get garbage collected.

2. will need manual inspection of the zephyr code

For 3. could you provide some adb logcat logs? Bonus: you can follow the instructions at [1] and provide more detail logs.

[1] https://www.chromium.org/developers/how-tos/file-web-bluetooth-bugs.
 
Looking at https://webbt-sensor-hub.appspot.com/ source, it looks like it is indeed reusing the services and characteristics from the first connection.

For info, we have added "Invalidate objects upon disconnect" row in our Chrome Implementation Status table at https://github.com/WebBluetoothCG/web-bluetooth/blob/gh-pages/implementation-status.md#chrome and we'll update it when it is clear.

And here's the Web Bluetooth Spec PR: https://github.com/WebBluetoothCG/web-bluetooth/pull/272


I would recommend you follow this pattern at https://googlechrome.github.io/samples/web-bluetooth/read-characteristic-value-changed.html to always retrieve services/characteristics when device gets disconnected.
Everytime we connect, we refetch primary service and both characteristics
I've added a onDisconnected function to https://googlechrome.github.io/samples/web-bluetooth/read-characteristic-value-changed.html which tries to reconnect.
Discussion is happening on GitHub at https://github.com/01org/zephyr.js/issues/148#issuecomment-256917006 for now.
Uploading trace here for the record, this is the same as the ones we uploaded to the github page.
demo_log.zip
155 KB Download
devel_log.zip
160 KB Download
Status: WontFix (was: Available)
Seems the issue has been resolved: https://github.com/01org/zephyr.js/issues/148#issuecomment-257733258

Sign in to add a comment