-
Notifications
You must be signed in to change notification settings - Fork 3k
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 - App crashes after turning off the internet connection #3485
Comments
Triggered auto assignment to @CortneyOfstad ( |
👋 Friendly reminder that deploy blockers are time-sensitive ⏱ issues! Check out the open
|
Triggered auto assignment to @TomatoToaster ( |
I've seen this and I'm trying to run the staging branch locally to fix this. Running into some issues with XCode and ECash so I'm resolving that right now. Haven't been able to recreate locally yet. |
👋 Any luck, @TomatoToaster? |
😞 No not really. I'm still not able to recreate this locally, and that would tell me most easily why this is happening. I'm trying to figure out from everything else I can use including the crash logs here. In the meantime I had looked through the PRs we had merged for this and I can't find anything that would cause this issue we're seeing. I can confirm this should still be a blocker though because this definitely isn't happening on the latest version of the app or the previous staging version. |
😭 I finally got it working locally. Ok I'm trying to figure out a fix for this. |
Sorry I had a bit of mixup, that is the most recent PR but it's not exactly the one that caused this specific regression. It's a part of the larger diff here: https://github.com/Expensify/react-native-onyx/compare/d0a5d12c08f2f029e3038fb3516a93a9403e9746..52c254fbc4b96224d2ac087e57ef6efc4210ccc1 From the crash logs it seems like this is is being called in an endless loop: So I don't think it makes sense to revert that PR, since that is actually fixing another breaking feature. I think what that PR fixes takes priority over not being able to use offline mode. I'm going to see if I can figure out a fix that won't fail to clear both of these deployblockers. |
@TomatoToaster You should mark this as a regression on that PR as everyone is waiting for issues related to that PR. |
So to clarify a bit more on what's happening, when the app goes offline we repeat these lines endlessly, causing stack to grow too huge too quickly and crash: https://github.com/Expensify/Expensify.cash/blob/533a0230986b3724397e1152f7ce70a2edb2569a/src/libs/Network.js#L42- I've tried changing various things to fix it but haven't gotten a good fix yet. |
Thanks for pointing it out @TomatoToaster. Matter of fact, I am working on a PR #2703 that changes this logic. You can pull in that PR to confirm if that fixes this problem. I will take a look at this issue and try to add a fix there on the PR. |
Your PR does manage to resolve this problem (I think). However, I wasn't able to verify it actually lets us recover from offline mode and send the queued actions when wifi is reactivated. I also think there also might be a simpler solution that fixes this. Either way, I think we don't need to keep this as a staging deployblocker. Since we're not going to revert all the Onyx changes, we can leave this as a daily regression and still keep working on a solution (or the PR @parasharrajat tagged above might get merged before then and this issue might dissapear). iOS offline mode will be broken for the meantime, but that's pretty workaroundable for most uses of the app. |
@TomatoToaster thanks for the links Here's what I've found out: We have a listener subscribed to The check here does not work well The code that follows updates Onyx and this triggers the The next value for The check can be updated to if (didLoadPersistedRequests || _.size(persistedRequests) === 0) {
return;
}
Alternatively you can call I think this was an existing issue, it just became exposed as now |
Here's a debug video of the loop: Expensify.cash.-.Google.Chrome.2021-06-10.15-23-56.mp4 |
I think you're spot on about this, @kidroca. I came to a similar conclusion by following the loops and already have a PR for it: #3511 It's a testament to how much faster Onyx is that we're seeing regressions like this 😄 . |
Now that I look at it again, we might have a problem with the new Now This can be a problem because Instead we should probably update
cc @marcaaron |
I'm thinking it would actually be better to avoid situations like the above by explicitly avoiding extra loops. We have a weird scenario here (or is this actually common in Expesnsify.cash?) where we're calling the I think the right solution here is to quit early for empty I think wrapping |
Yes, the fix is good it should stay whatever is decided
So far everything worked without expectation of how long it would take for My concern is only that now E.g. if you have a button component that calls |
Another options would be to use the InteractionsManager and run the |
Just catching up here, but nice detective work everyone! I hear where you are coming from @TomatoToaster, but I think in general we should first try to preserve the original behavior we had when it's something low level like this and could potentially affect many things. Since the entire app has been built on the assumption that subscribers are notified async I think we should maybe continue this way for now and move the |
There's no real problem with the original code - if we can assume things are asynchronous. The order doesn't make any difference in that case. But maybe it's a little confusing if you're not familiar with how Onyx will work. Also, separately, I think there is maybe a strong case to discuss a future where Onyx isn't an asynchronous system now that we have the local caching stuff. But probably requires a larger conversation. |
I think the code should still be updated, since Also why not disconnect from Onyx and release this connection - nothing would ever set |
sure, it could be improved (like many things) - but those issues are not causing an infinite loop 🙃 |
If you haven’t already, check out our contributing guidelines for onboarding and email contributors@expensify.com to request to join our Slack channel!
Expected Result:
User status is shown offline and can explore the app
Actual Result:
App crashes when turning off the internet connection
Action Performed:
Workaround:
Unknown
Platform:
Web
iOS ✔️
Android
Desktop App
Mobile Web
Version Number: 1.0.66-0
Logs: https://stackoverflow.com/c/expensify/questions/4856
Notes/Photos/Videos: Any additional supporting documentation
Bug5105198_Crash.mp4
ios crash.txt
Expensify/Expensify Issue URL:
View all open jobs on Upwork
The text was updated successfully, but these errors were encountered: