Skip to content

Conversation

@LukasPaczos
Copy link

Description

Refs 562e8e7#r92415581.

@LukasPaczos LukasPaczos requested a review from a team as a code owner December 8, 2022 13:47
@LukasPaczos LukasPaczos added the skip changelog Should not be added into version changelog. label Dec 8, 2022
@codecov
Copy link

codecov bot commented Dec 8, 2022

Codecov Report

Merging #6705 (0c9e479) into main (79e3cb2) will increase coverage by 0.00%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            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           
Impacted Files Coverage Δ
...ava/com/mapbox/navigation/core/MapboxNavigation.kt 70.63% <83.33%> (+0.07%) ⬆️

@LukasPaczos LukasPaczos force-pushed the lp-reset-trip-blocking branch from dacb11a to 0c9e479 Compare December 8, 2022 15:42
@LukasPaczos LukasPaczos enabled auto-merge (rebase) December 8, 2022 16:30
@LukasPaczos LukasPaczos merged commit 88b9076 into main Dec 8, 2022
@LukasPaczos LukasPaczos deleted the lp-reset-trip-blocking branch December 8, 2022 16:33
// 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 {
Copy link
Contributor

@VysotskiVadim VysotskiVadim Dec 9, 2022

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:

  1. User calls MapboxNavigation#resetTripSession() from a main thread
  2. runBlocking stops and holds main thread until it receives callback from NN
  3. NN does some heavy actions and posts callback to main thread via events queue
  4. 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.

Copy link
Author

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.

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

skip changelog Should not be added into version changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants