New issue
Advanced search Search tips

Issue 686583 link

Starred by 2 users

Issue metadata

Status: Duplicate
Merged: issue 647673
Owner: ----
Closed: Feb 2017
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug

Blocking:
issue 490399



Sign in to add a comment

Android web bluetooth characteristic change notification duplicate values

Reported by harri...@harrisonpham.com, Jan 29 2017

Issue description

Chrome Version       : Android 55.0.2883.91 (Official Build) (32-bit) and Android 58.0.2994.3 (Official Build) canary (32-bit)
URLs (if applicable) : https://dev.hdpham.com/ble/nrf_uart_bug_repro.htm
Other browsers tested:
  Add OK or FAIL, along with the version, after other browsers where you
have tested this issue:
     Safari:
    Firefox:
         IE:

What steps will reproduce the problem?
(1) Navigate to https://dev.hdpham.com/ble/nrf_uart_bug_repro.htm (ignore cert error), connect to custom 'Rainbow' BLE device.  This device provides a Nordic UART service that sends data using characteristic notifications.
(2) Click "Send 'Hello world'" button, this will cause the device to send 10 notifications in sequence with an incrementing payload.
(3) Notice that the payload values are incorrect, some are duplicated.  Duplicated values change on each run.

What is the expected result?
Values received from the device are correct, in order, and not duplicated.

What happens instead?
Values received from the device are duplicated.  The correct number of notifications are received, but the values are repeated.

Please provide any additional information below. Attach a screenshot if
possible.

Additional Notes:
Works correctly on Chrome OS and Mac OS X builds.  Only broken on Android builds.  Android apps providing Nordic UART capabilities (such as nRF UART v2.0 and Bluefruit LE) function correctly.  Does not appear to be a Android API / platform bug.  Appears isolated to the Chrome Android implementation.

Android Device: Pixel, Android 7.1.1, Build NMF26U; Also tested on Pixel C

Bluetooth Device: Custom hardware / firmwmare, hex file for Nordic nRF52 dev kit can be provided

Attached:
- Screenshot of output showing duplicate values
- Sanitized logcat output
- Sanitized blueooth HCI btsnoop log (for Wireshark)
 
Screenshot (Jan 29, 2017 1-05-56 PM).png
149 KB View Download
logcat_notification_duplicate_sanitized.txt
10.1 KB View Download
btsnoop_notification_duplicate_sanitized.log
1.1 KB View Download

Comment 1 by ortuno@chromium.org, Jan 29 2017

Thanks for the detailed report! This might be  Issue 647673 

Comment 2 by ortuno@chromium.org, Jan 29 2017

Blocking: 490399
Components: IO>Bluetooth
Labels: -Pri-3 OS-Android Pri-2
Status: Available (was: Unconfirmed)
It is definitely what I predicted in https://bugs.chromium.org/p/chromium/issues/detail?id=647673. Now you just verified it!

The Android stack itself only sends each notification once. Since gatt callbacks (in Android's Java API that uses Binder) are serialized for each gatt object, it will always work correctly if you extract the value from the characteristic directly in the callback on the same thread. If the work to extract the characteristic value is deferred, it can of course occur at a later point when another notification has arrived, especially if you send multiple notifications in the same connection event.

Due to the fact that the issue does not appear on other platforms, I'm pretty sure this must be the root cause.

Comment 4 by ortuno@chromium.org, Feb 20 2017

Mergedinto: 647673
Status: Duplicate (was: Available)

Sign in to add a comment