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

doFactoryReset call fails indeterministically #517

Open
2 of 10 tasks
korzonkiee opened this issue Dec 9, 2024 · 2 comments · May be fixed by #518
Open
2 of 10 tasks

doFactoryReset call fails indeterministically #517

korzonkiee opened this issue Dec 9, 2024 · 2 comments · May be fixed by #518
Labels
bug Something isn't working

Comments

@korzonkiee
Copy link
Contributor

Platform on which you observed the bug:

  • Android
  • iOS
  • Other
  • Platform is not relevant for this bug

Device on which you observed the bug:

  • Polar OH1
  • Polar Verity Sense
  • Polar H10
  • Polar H9
  • Other
  • Device is not relevant for this bug

Describe the bug

When calling doFactoryReset, it sometimes fails to complete without any error being reported. After conducting some investigation and adding more logging, I identified that the execution halts at the following line in the BDBleApiImpl.kt file:
https://github.com/polarofficial/polar-ble-sdk/blob/master/sources/Android/android-communications/library/src/sdk/java/com/polar/sdk/impl/BDBleApiImpl.kt#L2053.

The issue appears to be related to the usage of blockingGet, which can lead to nondeterministic behavior. Using blockingGet is generally not recommended, as it can introduce race conditions or unpredictable behavior in asynchronous operations.

Proposed Fix:

The use of blockingGet is unnecessary in this case, as we can save the backupFiles earlier at this line:
https://github.com/polarofficial/polar-ble-sdk/blob/master/sources/Android/android-communications/library/src/sdk/java/com/polar/sdk/impl/BDBleApiImpl.kt#L1963. This would align the Android implementation with the iOS implementation and eliminate the need for blocking calls.

Outcome:

After applying the fix by saving the backup files earlier, I was no longer able to reproduce the issue, and the doFactoryReset completed successfully.

@korzonkiee korzonkiee added the bug Something isn't working label Dec 9, 2024
korzonkiee added a commit to korzonkiee/polar-ble-sdk that referenced this issue Dec 9, 2024
@korzonkiee korzonkiee linked a pull request Dec 9, 2024 that will close this issue
@korzonkiee
Copy link
Contributor Author

Fixed in #518

@palmqvisti
Copy link
Contributor

FLOW-60985

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants