-
Notifications
You must be signed in to change notification settings - Fork 2
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
iOS crash due to recursive call while starting app in the ongoing state with the native consent missing #18
iOS crash due to recursive call while starting app in the ongoing state with the native consent missing #18
Comments
In the general case, the
But in this case, we delayed initializing the TripDiaryStateMachine because there was no consent. Normally, if there is no consent, the user has not installed the app, so the state machine has not been initialized, so this will not happen. So this is a really corner case. But the fix is pretty simple. We can just check for the consent before registering for the notifications too. |
Back in the old days, we tried to move all storage to local storage so that we could read it without waiting for ionicPlatform.ready and startup quickly. Well, it turned out that sometimes local storage was deleted on iOS, so we ended up with the case where local intro_done was deleted, so we would reset the UI. Which looked stupid and like a bug (https://github.com/e-mission/e-mission-phone/issues/443). Re-writing to pull out the KV storage into a service, write primarily to native with local as backup, and read from both and unify. Everything was already promisified because we were reading consent from native code, so I am not sure that this actually affects performance. And it is a heck of a lot easier to understand. Testing done: - started app -> went to intro - restarted app after restarting emulator -> went to current screen. For fixes to the current screen, see 0ecfdae - cleared out intro_done and consent from local storage and restarted app -> went to current screen - cleared all native storage, generated popups for intro_done and consent, then crashed due to e-mission/e-mission-transition-notify#18 On relaunch, launched properly without any popups. I declare that this is done. ``` [phonegap] [console.log] DEBUG:uc_stored_val = null ls_stored_val = {"intro_done":"2018-09-25T13:14:51-07:00"} ```
ok so I ran into this in a slightly different context (e-mission/cordova-jwt-auth#33). In this case, the FSM state does not matter. Instead, the client calls
which calls The final fix needs to address this use case as well. The entire call stack is as below.
|
I'm not convinced this is the same issue as #33, although that issue was contributed via video, so I cannot say whether it's the second time the user tried to open the OpenToAll login. |
If we are, we skip the call to allow the original call to complete. This is part of the fix - the other part will be checked in to the transition notifier shortly. This fixes e-mission/e-mission-transition-notify#18
If we are, this will return NULL and we skip the translation since it is unlikely to be a real transition anyway. This is part of the fix - the other part will be checked in to the transition notifier shortly. This fixes e-mission#18
This fix didn't work. |
Essentially it makes it so that every call except the first one returns null. |
ok so let's try to fix this the principled way. The fundamental problem is that as part of There can be any number of listeners to the action and they can do anything, including calling the The main problem is that the action listeners all execute in the same thread as the
there is only one call to
|
the first option is really not consistent with the current code. We do a lot of tracking code actions in that init. We could move all of them to separate threads for consistency, but then we would need to re-test super carefully. The other option is to restrict access to the
|
See discussion at e-mission#18 (comment) This fixes e-mission#18
This is a super corner case, but I want to document it in case we can fix it as part of the upcoming refactoring. This happens only IFF:
If there is no native consent set, but there is local consent, we call
markConsented
which calls
initWithConsent
, which creates theTripDiaryStateMachine
usingself.tripDiaryStateMachine = [TripDiaryStateMachine instance];
While creating the TripDiaryStateMachine, we look to see whether the currState is the ongoingTripState
startTrackingActions
generates a notificationwhich calls
fireGenericTransitionFor
, which in turn callsThis is a recursive call, so this fails.
The text was updated successfully, but these errors were encountered: