bluetooth: can't connect to device after 3 minutes
Reported by
emil.len...@gmail.com,
Jan 16 2017
|
||||||||
Issue descriptionChrome Version: 57.0.2982.0 Canary OS: Mac OS X 10.10.2 Try the example at https://googlechrome.github.io/samples/web-bluetooth/device-disconnect.html. After you have connected to a device, press disconnect, wait for 3 minutes and then press reconnect. Output: Requesting Bluetooth Device... Connecting to Bluetooth Device... > Bluetooth Device connected > Bluetooth Device disconnected Connecting to Bluetooth Device... Argh! NetworkError: Bluetooth Device is no longer in range. The device is certainly in range but since the browser has not made a scan during the last 3 minutes the device is removed from the cache and therefore refuses to connect. We can't have it that way. A pretty common thing that happens if you want to have a long-lived connection is that the connection eventually gets lost due to for example radio interference (disconnected due to supervision timeout) and you immediately need to reconnect to re-establish the link by calling device.gatt.connect(). An example that also seem to crash Chrome's bluetooth is to first scan. Before connecting, stop advertising on the peripheral. Then call device.gatt.connect() and wait 3 minutes. Then start advertising. These steps can be done from https://googlechrome.github.io/samples/web-bluetooth/device-disconnect.html as well; simply stop advertising on the peripheral as soon as the device has popped up in the device selector UI, before you connect. What's happening then is that the bluetooth system stops working in that tab. Requesting a new device does not put up any UI and all other gatt commands do nothing, promises neither resolve nor reject etc. The standard mentions nothing about timeouts and it even explicitly states for the connect() method: "Note: These procedures can wait forever if a connectable advertisement isn’t received.". Cause seems to be related to this function: https://chromium.googlesource.com/chromium/src/+/15b1f5307b13a30002693aa1907819c447db4954/device/bluetooth/bluetooth_adapter.cc#375
,
Jan 16 2017
Exactly. If I have a pending connection for 3 minutes, then start advertise (the promise does not resolve nor reject), then press scan then the scan UI does not show up.
,
Jan 16 2017
,
Jan 17 2017
ortuno@ do you mind having a look as well?
,
Jan 18 2017
We do it this way because of BlueZ :( On BlueZ a device gets removed if it has not been seen for 3 minutes. It's the only platform where this happens. Maybe we could update the timestamp when the device disconnects. That would address the use case. I still need to investigate what happens on BlueZ and how hard it would be to implement this.
,
Feb 8 2017
,
Feb 10 2017
Thanks for taking a first stab at it perja. When talking to scheib we realized this was much more complex so I drafted a quick design doc: https://docs.google.com/document/d/19hZCX64sERewJwJreFjkMCc_owp86N60fnoMBAYJKM4/edit?usp=sharing
,
Jun 29 2017
perja, if you resume work here, great, but until then I'll mark this Available.
,
Dec 4 2017
,
Dec 4
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
,
Dec 5
|
||||||||
►
Sign in to add a comment |
||||||||
Comment 1 by fbeaufort@chromium.org
, Jan 16 2017Labels: OS-Mac
Status: Available (was: Unconfirmed)