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

Fix stack overflow caused by scanPeriod of 0s #572

Merged
merged 3 commits into from
Aug 29, 2017

Conversation

davidgyoung
Copy link
Member

When upgrading an existing app to 2.12 the ScanState serialization file would not yet exist. Then when the app ran for the first time, it would find a missing file when deserializing it, yielding a scan period of 0. This would then cause a stackoverflow constantly stopping and starting scans. This was reported in #571.

The fix is to check if the scan period is zero and if so, immediately quit the scan job. A test showing the fix works is in the log below.

$ adb logcat | grep ScanJob
08-27 16:07:42.219  1125  1125 I ActivityManager: Start proc 15083:org.altbeacon.beaconreference/u0a236 for service org.altbeacon.beaconreference/org.altbeacon.beacon.service.ScanJob
08-27 16:07:42.631 15083 15083 I ScanJob : Running periodic scan job: instance is org.altbeacon.beacon.service.ScanJob@608a65e
08-27 16:07:42.638 15083 15083 D ScanJob : Processing 0 queued scan resuilts
08-27 16:07:42.638 15083 15083 D ScanJob : Done processing queued scan resuilts
08-27 16:07:42.638 15083 15083 I ScanJob : scanJob version 2.12.1-2-gd170b8c-SNAPSHOT is starting up on the main process
08-27 16:07:42.679 15083 15083 E ScanState: 	at org.altbeacon.beacon.service.ScanJob.restartScanning(ScanJob.java:150)
08-27 16:07:42.679 15083 15083 E ScanState: 	at org.altbeacon.beacon.service.ScanJob.startScanning(ScanJob.java:200)
08-27 16:07:42.679 15083 15083 E ScanState: 	at org.altbeacon.beacon.service.ScanJob.onStartJob(ScanJob.java:77)
08-27 16:07:42.806 15083 15083 W ScanJob : Starting scan with scan period of zero.  Exiting ScanJob.

This was caused by a missing scan state file on an upgrade to 2.12
@davidgyoung davidgyoung merged commit d746ef3 into master Aug 29, 2017
@cupakromer cupakromer deleted the fix-stackoverflow-on-zero-scan-period branch November 29, 2017 00:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant