New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 621901 link

Starred by 4 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug

Blocking:
issue 518942
issue 597889



Sign in to add a comment

bluetooth: Callbacks are dropped when the device disconects during a GATT Operation

Project Member Reported by fbeaufort@chromium.org, Jun 21 2016

Issue description

Google Chrome	53.0.2768.0 (Official Build) dev (64-bit)
Revision	9cd2e77b728d6d5ac115acd944b37df70423c355-refs/heads/master@{#399800}
Platform	8459.0.0 (Official Build) dev-channel link

What steps will reproduce the problem?

Play too much with Web Bluetooth API and sometimes, sometimes sadly, `navigator.bluetooth.requestDevice` doesn't show bluetooth chooser anymore.

I've looked at file:///home/chronos/user/log/chrome and file:///var/log/chrome/chrome after enabling Web Bluetooth debug logs and I see nothing...

Refreshing the tab/page makes it works again though.
If I duplicate a tab, it works again also.
 
Refreshing the tab/page does NOT make it work again.

Comment 2 by juncai@chromium.org, Jun 23 2016

Tried it several times and not be able to see the issue. Is there a stable way to reproduce this issue?
None that I've noticed. For info, it happened again today without any obvious pattern ;(
Labels: OS-Mac
Ah! I was able to reproduce it! See recording attached.

Note that I use BLE Peripheral Android app as a nearby BLE device which features a missing Characteristic descriptor making startNotifications hangs on forever. Not sure if this is related or not...



web-bluetooth-chooser-not-triggered.mov
6.8 MB Download
This is happening because a callback, in the mac case the start notifications callback, is getting dropped which causes our Web Bluetooth Service to be destroyed. I opened an issue with the mojo folks to add some logs or a CHECK when this happens so that we can find the culprit:  Issue 624999 

Comment 6 by kran...@gmail.com, Jul 4 2016

Sry didn't see this bug report, opened a different one earlier. May be mark as duplicate and close?

https://bugs.chromium.org/p/chromium/issues/detail?id=625408

I have seen this with valid characteristic also not just with missing characteristic reported.



Labels: -OS-Mac
This is a different issue. In  Issue 625408  the chooser shows up but the device is not included. On this issue the chooser doesn't show up at all.

Marking this as Chrome OS only since the culprit on mac was  Issue 624999 
Correction: The culprit on mac was  Issue 624745 
Happens for me as well quite often on Mac OS X at Chrome 53. Page reload doesn't work. I have to open a new tab.
Can you reproduce in Chrome Canary as well?
You can download it from https://www.google.com/chrome/browser/canary.html
Yes same there (55.0.2859.0).
I actually think the whole Web Bluetooth stuff stops working when that happens. I usually test connect a device, then I disconnect (device.gatt.disconnect()) and then shortly after reconnect (device.gatt.connect()). Then it seems the device never reconnects even though it's next to the computer and it's advertising. I don't get the connect promise resolved nor rejected, it's just that nothing happens. When I at that time execute requestDevice, nothing happens.

I just tested connecting two Bluetooth devices as well. When I have both connected and I for one device first disconnect and then connect again, it often (about 50 % of the times) happens that both gets disconnected and Web Bluetooth stops working. No callbacks are sent to the web page's javascript so as far as the script is aware of the first device is still connected.
That's definitely a bug. I tried reproducing with a Nexus 6 and https://googlechrome.github.io/samples/web-bluetooth/device-disconnect.html but couldn't. What device are you using? Could it be possible to get some logs? Here are the instructions: https://www.chromium.org/developers/how-tos/file-web-bluetooth-bugs
Aha I think I got it. I run on Mac OS X 10.10.2, MacBook Air 2014.

The web bluetooth on the page stops working as explained if there is a pending GATT write operation when the peripheral gets disconnected.

It doesn't stop working directly when I execute device.gatt.disconnect() but rather when the device actually disconnects (i.e. the ACK is received from the peripheral). OR if there is a pending GATT write operation and the link then drops due to supervision timeout.

This happens 100% of the time.
Owner: ortuno@chromium.org
Status: Started (was: Available)
Thanks for the perseverance! Seems like we aren't correctly handling disconnections while there are pending GATT operations. I'm currently working on fixing the issue.
Labels: -OS-Chrome OS-Mac
Labels: -OS-Mac OS-All
The fix will be implemented in the following patches:

1. Fix read and write on mac
2. Fix read and write on android
3. Fix read and write on windows
4. Fix notifications on mac
5. Fix notifications on windows

The reason we are fixing notifications in separate CLs is because we need to implement a new part of the API for them to be fixed.
Project Member

Comment 17 by bugdroid1@chromium.org, Sep 23 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/0fb374e6d52746fa37dc66f9bbb3f56a5eb11883

commit 0fb374e6d52746fa37dc66f9bbb3f56a5eb11883
Author: ortuno <ortuno@chromium.org>
Date: Fri Sep 23 03:04:53 2016

bluetooth: Call error callback when characteristics get destroyed during a GATT Event (mac)

When a device disconnects all its characteristics get destroyed which
was causing callbacks for GATT operations to get dropped. This patch
fixes only mac's write and read. Follow up patches will fix android and
windows.

BUG=621901

Review-Url: https://codereview.chromium.org/2347133002
Cr-Commit-Position: refs/heads/master@{#420558}

[modify] https://crrev.com/0fb374e6d52746fa37dc66f9bbb3f56a5eb11883/device/bluetooth/bluetooth_remote_gatt_characteristic_mac.mm
[modify] https://crrev.com/0fb374e6d52746fa37dc66f9bbb3f56a5eb11883/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc

Summary: bluetooth: Callbacks are dropped when the device disconects during a GATT Operation (was: bluetooth: navigator.bluetooth.requestDevice doesn't show bluetooth chooser)
 Issue 597890  has been merged into this issue.
Cc: gogerald@chromium.org
 Issue 597888  has been merged into this issue.
Project Member

Comment 21 by bugdroid1@chromium.org, Nov 8 2016

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/650a52d4b71f0c029b4278910ed7cf0a127fd3c4

commit 650a52d4b71f0c029b4278910ed7cf0a127fd3c4
Author: ortuno <ortuno@chromium.org>
Date: Tue Nov 08 01:36:30 2016

bluetooth:android: Run error callback when characteristic is destroyed

When a device disconnects we destroy its attributes. This meant that
if a device disconnected during a gatt operation we would drop the
callbacks in BluetoothRemoteGattCharacteristicAndroid. This patches fixes
that by calling the error callback when the characteristic is being
destroyed.

BUG=621901

Review-Url: https://codereview.chromium.org/2481683002
Cr-Commit-Position: refs/heads/master@{#430468}

[modify] https://crrev.com/650a52d4b71f0c029b4278910ed7cf0a127fd3c4/device/bluetooth/bluetooth_remote_gatt_characteristic_android.cc
[modify] https://crrev.com/650a52d4b71f0c029b4278910ed7cf0a127fd3c4/device/bluetooth/bluetooth_remote_gatt_characteristic_unittest.cc
[modify] https://crrev.com/650a52d4b71f0c029b4278910ed7cf0a127fd3c4/device/bluetooth/bluetooth_remote_gatt_characteristic_win.cc

Cc: ortuno@chromium.org
Owner: ----
Status: Available (was: Started)
Only windows is missing.
Besides windows this is also missing for Descriptors in Android and macOS (though read/write is not yet implemented on macOS).
Blocking: -420284 597889 518942
Project Member

Comment 25 by sheriffbot@chromium.org, Apr 12 2018

Labels: Hotlist-Recharge-Cold
Status: Untriaged (was: Available)
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue.

Sorry for the inconvenience if the bug really should have been left as Available.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Status: Available (was: Untriaged)

Sign in to add a comment