Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible concurrency issue in scan #17

Closed
jihyeon opened this issue Apr 29, 2016 · 1 comment
Closed

Possible concurrency issue in scan #17

jihyeon opened this issue Apr 29, 2016 · 1 comment
Labels
bug Bug that is caused by the library

Comments

@jihyeon
Copy link

jihyeon commented Apr 29, 2016

If we unsubscribe the scan right after subscribe (e.g., repeated activity pause/resume, or timeout/retryWhen), scanning started after stop request. We have to kill the app to stop it.

Here's a brief logcat output for the scenario.

// Subscribe and scan start

D/AObserver(31609): start scan
D/RxBle#Radio(31609):   QUEUED RxBleRadioOperationScan(7307165)
D/RxBle#Radio(31609):  STARTED RxBleRadioOperationScan(7307165)

// RxBleRadioImpl thread is running but startLeScan() is not called yet
// now we pause the activity and unsubscribe

V/AActivity(31609): ⇢ onPause()
D/AObserver(31609): Frodo => [@Observable#observe -> @SubscribeOn -> main :: @ObserveOn -> main]
D/AObserver(31609): Frodo => [@Observable#observe -> onUnsubscribe()]
D/BluetoothAdapter(31609): stopLeScan()
D/BluetoothAdapter(31609): scan not started yet    <------------------!!!!!!!!!!!
V/AActivity(31609): ⇠ onPause()

// RxBleRadioImpl thread is still running in the background
// and start the scan

D/BluetoothAdapter(31609): startLeScan(): null
D/BtGatt.GattService(13895): registerClient() - UUID=f17ebcd4-...
D/BtGatt.GattService(13895): onClientRegistered() - UUID=f17ebcd4-..., clientIf=5
D/BluetoothLeScanner(31609): onClientRegistered() - status=0 clientIf=5
D/BtGatt.GattService(13895): start scan with filters
D/BtGatt.ScanManager(13895): handling starting scan
D/BtGatt.ScanManager(13895): configureRegularScanParams() - queue=1
D/BtGatt.ScanManager(13895): configureRegularScanParams() - ScanSetting Scan mode=2 ...
D/RxBle#Radio(31609): FINISHED RxBleRadioOperationScan(7307165)
D/BluetoothLeScanner(31609): onScanResult() - ScanResult{mDevice= ...}
D/BluetoothLeScanner(31609): onScanResult() - ScanResult{mDevice= ...}
D/BluetoothLeScanner(31609): onScanResult() - ScanResult{mDevice= ...}
......

// there's no way to stop the scan. we have to kill the app
@uKL uKL added the bug Bug that is caused by the library label Apr 29, 2016
dariuszseweryn added a commit that referenced this issue Jun 6, 2016
Reviewers: michal.zielinski, pawel.urban

Reviewed By: pawel.urban

Differential Revision: https://phabricator.polidea.com/D1628
@dariuszseweryn
Copy link
Owner

Should be fixed in 4d92c4f

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug that is caused by the library
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants