-
Notifications
You must be signed in to change notification settings - Fork 86
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
App doesn't sync after coming from the background #2396
Comments
We should fix this. It's a blocker! |
Since this is a regression, it's worth investing in a test, which also means fixing mobile e2e tests before the release. At quick glance, it looks like Detox can test sending the app to background and returning from background, so let's do it: https://wix.github.io/Detox/docs/next/api/device/#devicelaunchappparams |
Let's first fix the issue and then see if there is a way to test this issue with our current setup. If there is, let's do it. If there isn't, let's not. Ideas for how to test this if we want to:
|
Lucas can't reproduce.
How short? Once the app goes into background and comes back, Tor has to restart and then it has to reconnect. This could take some time.
This is the most interesting and confusing part. Why would the last release behave differently? Is it possible that in production, when you switch away and switch back, the app is not getting sent to the background? Could there be some difference in performance or memory usage, or in the context in which Kinga is testing, that changes how quickly the app goes into the background? |
I think overall we should treat this as an iOS+Tor reliability question to resolve in the future, and assume that the app will sync if given enough time and enough tries. Let's move this out of sprint since we can't reproduce it. Also, @kingalg and @leblowl are you testing on the same device? Which device? |
I'm testing on an iPhone SE 2nd gen |
Notes: Lucas also sees long syncing times after returning to foreground in production, and suspects that we could reproduce the error on desktop as well after restarting. These are the logs when there is a delay in restarting the connection:
It may mean other things too. |
@holmesworcester Device - I'm also using iPhone SE 2nd gen |
@kingalg I just open the app, connect to a community, then put the app in the background, do something else (open maps or something that requires a lot of resources), wait maybe 20 seconds, then open the app again. I was able to reproduce this on production, where it didn't sync after 15 minutes or more. I think restarting the app fixes things. But I can play it with more, maybe it happens more often on the current alpha then production. Either way I think there is likely a bug here that we can fix. |
@leblowl did you send any message from another app when this one was in the background? And yes, restarting the app fixed it, as the issue is only with the app not syncing after returning from the background (it was working exactly like this in the past, but after Wiktor introduced some changes, the app was syncing correctly). I'm really curious why we are getting such different results on the same version and the same device. That's interesting. |
Lucas can reproduce this because it happens frequently enough but probably anyone can. |
I looked into this more, and it looks like since we are now randomizing ports when iOS resumes from background, the HTTP tunnel port that the backend uses to connect to Tor changes. Libp2p has an auto-dialer that re-dials peers, which is how we re-connect to peers when the app resumes. However, in the version of libp2p that we are using, it dials peers sequentially and once the HTTP tunnel port changes, it looks like it just gets hung up waiting for a socket to connect and it never does and we never receive a ECONNREFUSED error, so the dialer just waits. The Ideally, to really fix this, when the app goes to background (or resumes), we can find a way to close any sockets that reference the old HTTP tunnel port. |
Let's make a new issue for the more complete fix. |
Discussion in Slack: https://zbay.slack.com/archives/G01EHE6JHCM/p1712937541294959 |
iOS 371 |
Version: 2.1.2-alpha.14 (367)
System: iOS
Issue: The App doesn't sync after coming from the background. The app on iOS never really works in the background, but for some time it was syncing correctly after it was reopened without a need for swiping up or force-quiting. Currently, it doesn't sync.
Steps to recreate: Have a working app on ios, exchange a few messages with another user on a different platform. Put the app on iOS into the background (leave and check a different app or let the iPhone turn the screen off). Do not swipe the app up, force quit it or restart the phone - make sure that it's still in the background. Open it again and try to send/receive a message. It should sync after a short time, but it never does.
Notes: I checked it again on our prod version and it is working there. So, this is a regression that only appeared at some point in one of the 2.1.2 alphas.
The text was updated successfully, but these errors were encountered: