-
Notifications
You must be signed in to change notification settings - Fork 319
block until deprecated MapboxNavigation#resetTripSession() finishes #6705
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #6705 +/- ##
=========================================
Coverage 72.46% 72.46%
+ Complexity 5415 5414 -1
=========================================
Files 764 764
Lines 29427 29432 +5
Branches 3491 3491
=========================================
+ Hits 21323 21327 +4
- Misses 6712 6713 +1
Partials 1392 1392
|
libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt
Show resolved
Hide resolved
libnavigation-core/src/main/java/com/mapbox/navigation/core/MapboxNavigation.kt
Outdated
Show resolved
Hide resolved
dacb11a to
0c9e479
Compare
| // no-op | ||
| // using a blocking function to keep parity with the original implementation so that | ||
| // Nav Native is fully done with the reset when this function returns | ||
| runBlocking { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@LukasPaczos , from the first glance it seems like it should always cause a deadlock:
- User calls
MapboxNavigation#resetTripSession()from a main thread runBlockingstops and holds main thread until it receives callback from NN- NN does some heavy actions and posts callback to main thread via events queue
- Event's queue aren't processes because main thread has stopped during step 2
I was surprised that it works and it turned out that NN calls the callback from their worker thread without rescheduling to the main thread, which is not typical for NN's API. Do you think it's safe to rely on this implementation detail of NN? I worry that if they change it, deprecated version of resetTripSession will always cause a deadlock.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for raising this. In the end no, we shouldn't really rely on this. This is a strong enough reason to try and find a different approach or work with Nav Native to leave the old function be, even if deprecated.
Tracking in NAVAND-984.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding a test as a safeguard that would block us from adopting a NN version that would break this logic - #6710.
Description
Refs 562e8e7#r92415581.