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

Issue 594525 link

Starred by 1 user

Issue metadata

Status: Verified
Owner:
Last visit > 30 days ago
Closed: Apr 2016
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: Bug

Blocked on:
issue 508771



Sign in to add a comment

characteristicvaluechanged is fired in batches

Project Member Reported by jakearchibald@chromium.org, Mar 14 2016

Issue description

Observed on a Nexus 5 and Nexus 6P, Chrome Dev & Chrome Canary respectively. Observed on Miband and heart rate monitor.

https://webbluetoothcg.github.io/demos/heart-rate-sensor/

I get between 30-50 characteristicvaluechanged events before they stop. Refreshing the browser doesn't bring them back, the tab must be closed and reopened to get another 30-50 events.
 

Comment 1 by scheib@chromium.org, Mar 14 2016

Components: IO>Bluetooth
Status: Available (was: Untriaged)

Comment 2 by ortuno@chromium.org, Mar 14 2016

There seem to be two issues here:

1. Notifications stops
2. After reloading notifications don't work.

Did the screen turn off by any chance? We currently disconnect when the screen turns off which would explain 1.

I'm still looking into 2.

Comment 3 by ortuno@chromium.org, Mar 14 2016

I was able to reproduce both. I'll look into why this is happening.
I didn't turn the screen off to trigger the notifications stopping.
1. I cannot reproduce this with the BLE Simulator Android App on a Nexus 6 and a Nexus 5 on https://webbluetoothcg.github.io/demos/heart-rate-sensor/
2. Yup. Could it be related to https://bugs.chromium.org/p/chromium/issues/detail?id=589796?
2. Yup. Could it be related to https://bugs.chromium.org/p/chromium/issues/detail?id=589796 ?

Comment 7 by ortuno@chromium.org, Mar 16 2016

1. Weird that you were not able to reproduce. I was able to reproduce with a N6 and N5 running as central and a N9 as a peripheral. After a while the events no longer reach js or if they do, they reach in batches rather than when they are received by the device.

2. Maybe. I need to check that part of the code more carefully. Also I'm refactoring that part of the code so it'll probably get fixed then.
1. I've been stressing the demo enough to notice these batches. As you can read from these adb logs, the 'characteristicvaluechanged' event is triggered in batches while "cr_Bluetooth: onCharacteristicChanged" have been logged properly ahead of time.

03-17 11:45:29.375  6404  6404 I WCNSS_FILTER: ibs_msm_serial_clock_vote: vote UART CLK ON using UART driver's ioctl()
03-17 11:45:29.378   354   380 I cr_Bluetooth: wrapper onCharacteristicChanged.
03-17 11:45:29.378   354   380 I cr_Bluetooth: device onCharacteristicChanged.
03-17 11:45:29.380   354   354 I cr_Bluetooth: onCharacteristicChanged
03-17 11:45:29.416  6404  6404 I WCNSS_FILTER: ibs_msm_serial_clock_vote: vote UART CLK OFF using UART driver's ioctl()
03-17 11:45:29.545  6404  6404 I WCNSS_FILTER: ibs_msm_serial_clock_vote: vote UART CLK ON using UART driver's ioctl()
03-17 11:45:29.548   354  1459 I cr_Bluetooth: wrapper onCharacteristicChanged.
03-17 11:45:29.548   354  1459 I cr_Bluetooth: device onCharacteristicChanged.
03-17 11:45:29.549   354   354 I cr_Bluetooth: onCharacteristicChanged
03-17 11:45:29.554   354   354 I chromium: [INFO:CONSOLE(16)] "valuechanged", source: http://localhost:8001/app.js (16)
03-17 11:45:29.586  6404  6404 I WCNSS_FILTER: ibs_msm_serial_clock_vote: vote UART CLK OFF using UART driver's ioctl()
03-17 11:45:29.770  6404  6404 I WCNSS_FILTER: ibs_msm_serial_clock_vote: vote UART CLK ON using UART driver's ioctl()
03-17 11:45:29.773   354   382 I cr_Bluetooth: wrapper onCharacteristicChanged.
03-17 11:45:29.774   354   382 I cr_Bluetooth: device onCharacteristicChanged.
03-17 11:45:29.775   354   354 I cr_Bluetooth: onCharacteristicChanged
03-17 11:45:29.812  6404  6404 I WCNSS_FILTER: ibs_msm_serial_clock_vote: vote UART CLK OFF using UART driver's ioctl()
03-17 11:45:29.951  6404  6404 I WCNSS_FILTER: ibs_msm_serial_clock_vote: vote UART CLK ON using UART driver's ioctl()
03-17 11:45:29.953   354   449 I cr_Bluetooth: wrapper onCharacteristicChanged.
03-17 11:45:29.953   354   449 I cr_Bluetooth: device onCharacteristicChanged.
03-17 11:45:29.954   354   354 I cr_Bluetooth: onCharacteristicChanged
03-17 11:45:29.992  6404  6404 I WCNSS_FILTER: ibs_msm_serial_clock_vote: vote UART CLK OFF using UART driver's ioctl()
03-17 11:45:30.131  6404  6404 I WCNSS_FILTER: ibs_msm_serial_clock_vote: vote UART CLK ON using UART driver's ioctl()
03-17 11:45:30.134   354   380 I cr_Bluetooth: wrapper onCharacteristicChanged.
03-17 11:45:30.134   354   380 I cr_Bluetooth: device onCharacteristicChanged.
03-17 11:45:30.135   354   354 I cr_Bluetooth: onCharacteristicChanged
03-17 11:45:30.174  6404  6404 I WCNSS_FILTER: ibs_msm_serial_clock_vote: vote UART CLK OFF using UART driver's ioctl()
03-17 11:45:30.319   354   354 I chromium: [INFO:CONSOLE(16)] "valuechanged", source: http://localhost:8001/app.js (16)
03-17 11:45:31.124   354   354 I chromium: [INFO:CONSOLE(16)] "valuechanged", source: http://localhost:8001/app.js (16)
03-17 11:45:31.971   354   354 I chromium: [INFO:CONSOLE(16)] "valuechanged", source: http://localhost:8001/app.js (16)
03-17 11:45:32.760   354   354 I chromium: [INFO:CONSOLE(16)] "valuechanged", source: http://localhost:8001/app.js (16)
03-17 11:45:33.590   354   354 I chromium: [INFO:CONSOLE(16)] "valuechanged", source: http://localhost:8001/app.js (16)
03-17 11:45:34.415   354   354 I chromium: [INFO:CONSOLE(16)] "valuechanged", source: http://localhost:8001/app.js (16)
03-17 11:45:35.229   354   354 I chromium: [INFO:CONSOLE(16)] "valuechanged", source: http://localhost:8001/app.js (16)
03-17 11:45:36.084   354   354 I chromium: [INFO:CONSOLE(16)] "valuechanged", source: http://localhost:8001/app.js (16)
Summary: characteristicvaluechanged is fired in batches (was: characteristicvaluechanged stops firing after about 15 seconds)
The issue isn't just batching. I can leave the device for many minutes and no further events are received. If I refresh the page I get no events.
If you leave the device for many minutes, I believe Android will turn off your screen which will then fire a visibilitychange event. This event actually disconnect your device, hence why you don't receive further events. Refreshing the page is another issue I believe: https://bugs.chromium.org/p/chromium/issues/detail?id=589796 
@fbeaufort: My experience was that first the events will start to get fired in batches rather than when they arrive, after a while I would stop getting events altogether.
Owner: ortuno@chromium.org
I don't need to turn off the screen to recreate this bug
Thanks Jake.
Gio, can you have a deeper look today?
(gentle ping)
I'm hoping this patch fixes the issue: http://crrev.com/1818663002
Status: Fixed (was: Available)
I've just tried with latest Chromium build (currently 52.0.2716.0) and after 324 notifications I wasn't able to reproduce it.
ortuno, jake can you have a look as well and confirm before marking this bug as Verified?
Status: Verified (was: Fixed)
Can't reproduce anymore.
Blockedon: 508771

Sign in to add a comment