-
Notifications
You must be signed in to change notification settings - Fork 34
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
Errors prompt re-login #276
Comments
@asiripanich, can you upload your logs too? (Profile -> Email log). You can email the log to yourself and upload it here, or you can email directly to me for greater privacy. |
Others have reported this issue before, but they have not been developers, so I have not been able to get the logs in time. Current speculation is that this is happens because of apps that are "offloaded" when you are short of space. So can you comment on how much space you have available? Also the logs will help me debug exactly what is not getting restored when the app is restored again. |
Sent my log file. The offload option has never been enable on my phone (iOS 11.4, iPhoneX). So that might not be the cause for my case. Space available on my phone: 54.4 GB of 64 GB used. |
A similar issue was reported by @manuelsantanap while testing on emTripLog. Let's use this issue to track the reset UI issue. |
I quickly looked through these logs to see if this was the same issue, and unfortunately, there are no such logs.
However, this is a not a debug build, so we really will not expect it to be. |
I tried to upgrade the plugin to see if that fixed the issue. Also, if I wanted to file an issue with ionic, they would likely be more responsive to a test against the most recent version. I ran into a separate issue with testing the most recent plugin (https://github.com/e-mission/e-mission-base/issues/3#issuecomment-411832143) that I filed an issue for. They have now apparently fixed it in v5.0.9. I can upgrade to 5.0.9, but I need help from @asiripanich and @manuelsantanap since I am unable to test locally. |
So v5.0.9 has fixed the immediate issue. Trying to see it if works even after rebooting... |
Current PR (e-mission/e-mission-base#5) |
I deployed a version with both this change and e-mission/e-mission-base#5 and tested by rebooting multiple times. Every time, the correct client was launched. @asiripanich @manuelsantanap do you have an ETA for when you can test this version out and see if it fixes the issue? |
An apk that includes changes from both e-mission/e-mission-base#4 and e-mission/e-mission-base#5 is attached here. For iOS testing, Manuel has already accepted my TestFlight invite - I will send out a new one to @asiripanich once I get his email. Please accept those invites so that you can test this version before I release it. |
Invited @asiripanich, waiting for response. Incidentally, waiting for response from @brianmickel as well, just resent invitation. |
Added in fixes in e-mission/cordova-jwt-auth#28 and e-mission/cordova-jwt-auth#31 as well by pulling them to a local copy of the auth plugin and then including it instead of the version from the internet. |
Here's the apk, uploading the ios version to TestFlight... emTripLog-ionic-5-plugin.apk.gz |
Hi @shankari, I can't find your invitation. Could you please resent it again? Thanks. |
Done. Please check the email that is associated with your AppleID - the invite is sent to that address. |
For some reason, the email that I shared with you haven't been receiving email since 04/2017. There is something wrong with its inbox which I still cannot fix. Is there an alternative? |
I originally thought that there wasn't, but it looks like the rules have changed.
Resending to your current email address... |
It is not letting me sign in with my appleID (not the one that you sent the invite to). :/ Sorry for the trouble. |
I think that if I send you an invite to a different address, it makes a new AppleID with that address -
So you need to click on the link in the invite, make a new AppleID and then sign in with that one. |
I met with @manuelsantanap and he was able to give me instructions to reproduce the issue in the android emulator:
However, when I try the same set of steps in the iOS emulator, I don't see the UI getting reset. @asiripanich can you give me instructions to reproduce? How did you manage to get the UI to reset? If I can reproduce the error, I can verify which ionic deploy update works, and then you don't need to test using TestFlight. |
I also tried on a physical device (running iOS 9.2) and it works fine. I force killed and then rebooted. No issues. |
ok, so I found an issue, although it is not the same one reported. But this is on iOS 9.2, so maybe it manifests itself differently. The steps that I followed, that worked only on iOS were:
emTripLog is still installed, however, when I try to launch it, it crashes consistently. @asiripanich do you have iTunes automatic backup turned on by any chance? |
@asiripanich also, what version of iOS are you running? |
ok, so I launched the app again on iOS 9.2, and captured the logs from the console when it crashed. The relevant logs are:
There are many matches for
but none for
Let's see if we can find the crash log for more details. |
Can't find the crash logs even after plugging in the phone and opening the "Devices" tab in Xcode. |
Aha! the crash was reproducible in debug mode, and the crash logs showed up with symbolication. The backtrace is
Related code is
Note that the code at the line is
https://developer.apple.com/documentation/foundation/nsregularexpression/1412446-matchesinstring This explains why we didn't find the relevant code through grepping. |
The last recommended ionic deploy if we want to support older android and iOS versions is 4.1.7
But that doesn't appear to have fixed this issue. It looks like the issue is that the new HTML was
I need to fork the ionic deploy code and fix it there. |
Ionic deploy 4.1.7 depends on ionic webview version 1.1.19, which should work on iOS 9+ |
This seems to be a slightly different issue than android, though, because
which means that it is read properly from the shared preferences. It looks like the real issue is that there is no html file for that uuid |
After adding some more logging, this is what I see:
|
Maybe this works better in "auto" mode for the plugin; which is the default, instead of "none" which is what I am using now. I'm going to try that out now... |
Also, the current version of the plugin (v5) doesn't seem to exclude the newly unzipped directory from backup, so a cheap fix may just be to comment out that code. |
wrt https://github.com/e-mission/e-mission-phone/issues/443#issuecomment-419149774, version 3.0.0 |
most recent backwards compatible release (v4.1.7) also fails on both android and iOS in exactly the same way. |
upgraded to v5.0.9 because moving to This is the version I had tested earlier, but it is now crashing consistently on the android 8 emulator, and I don't know why. Might try to rebuild from the checked in version to see if that fixes it, but don't want to spend too much time on this since I know that it is not going to be the final solution anyway because of the need to support older versions at least for now. |
wrt https://github.com/e-mission/e-mission-phone/issues/443#issuecomment-419263343,
This was because of Out Of Memory (OOM) errors. I closed everything except for android studio and it ran. Current outcome of 5.0.9 -
|
Filed issue against ionic for the iOS stuff. |
Hi @shankari, this has happened to me many times even with iOS 12 beta. Thank you for all the updates. |
Ok, so I was finally able to reproduce this exact behavior in an emulator. I wasn't expecting it to happen, so I didn't get as many logs as I had hoped, but maybe if I try it again, it will happen again. Steps that I did:
Since the app was still running in the debugger, I was able to extract logs, which I have attached here. |
So right now, the issue appears to be the race between resetting the base path, and reloading the new javascript. It is only in that window of time that we see errors.
|
I'm going to replace those alerts with javascript alerts so that the javascript execution is paused and I can see the current state of the loaded app when the errors occur. I'll have to do that on a different channel, one that nobody is using. Let's use interscity which I think nobody is using right now. |
Just tried the same steps as https://github.com/e-mission/e-mission-phone/issues/443#issuecomment-420290336 In step 2, app launched with custom channel. Dunno how/why this works sometimes and not other times. |
I am an idiot. Given that I was able to reproduce this, I was able to figure out what happened. And suddenly it all became clear. First, we cannot use localstorage reliably (at least on iOS) because the OS clears it if the phone is low on space.
So the check for local storage versus native storage fails periodically and generates the first popup.
And then we call
But the localStorage API doesn't have put! The correct call, as we can see here
is So basically, the iOS fix consists of two parts:
|
I think that the long-term solution is to remove all instances of angularLocalStorage and replace them with native storage. However, sometimes native storage is flaky too (see the android plist issue) and I am reluctant to rely only on it. Note that I currently have double-backups - if there is local storage but not native storage, then I set the native storage and if there is native storage and not local storage, I set the local storage. Arguments in favor of switching entirely to native storage:
Arguments in favor of keeping the backup:
For now, I will refactor the storage into its own class that will have the interface of native storage, but will include the backup of checking against local storage. This will simplify the interface, keep the backup in place, and make it easier to remove the backup if it turns out to not be necessary. |
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 now that we have figured out the iOS issue, we need to look at the android issue. I put a breakpoint in the code that displays the debug message (https://github.com/e-mission/e-mission-base/issues/3#issuecomment-410544856). The backtrace is:
The uuid is This seems pretty correct. Is this just a debug issue and it works in release builds. Let's try to reproduce. |
Yes, this is only a debug issue. Let's try to see if the upgrade issue still exists and fix it. |
upgrade issue still exists. Let's see again what the underlying issue is. |
Fixed by changing code in
|
There is similar code on iOS as well. Let's remove it and verify
|
Verified that default code caused the reset. |
Unable to reproduce the previous issue. Went from version 6 -> version 10, updating at every stage and it loaded just fine. |
@asiripanich I spent a whole day deploying all the fixes and I believe that this issue is fixed. The fork of the deploy plugin is now in emTripLog (e-mission/e-mission-base#10, https://github.com/e-mission/e-mission-base/releases/tag/v1.1.0, e-mission (#481, https://github.com/e-mission/e-mission-phone/releases/tag/v2.7.1)and em-devapp (e-mission/e-mission-devapp#7, https://github.com/e-mission/e-mission-devapp/releases/tag/v2.0.2). The changes to store state in native, rather than local storage (e-mission/e-mission-phone#478) are checked into master. I have also merged these changes from master (e-mission/e-mission-phone#484) and deployed a new version to your channel. Can you keep an eye out and confirm that the UI does not get reset any more? Thanks! |
@asiripanich can you confirm that this issue is now fixed? |
@shankari Yes, we no longer experience this issue. But we are not sure if this is because the updates you made or us switched to the cci branch. |
you didn't actually switch to the cci channel, right? You just merged from the channel? |
Yes we merged. Sorry for the confusion. :) |
After a few hours of leaving the app on the background on my phone, I received these errors when I launched the app to check. It went back to the login step which I had done when I first installed the app.
Any idea what might be the cause of these errors?
The text was updated successfully, but these errors were encountered: