Skip to content
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-client cannot be in Connected state after switching to the background. #1899

Open
jiangslee opened this issue Apr 29, 2024 · 12 comments
Open

Comments

@jiangslee
Copy link

jiangslee commented Apr 29, 2024

Describe the problem

Sorry for posting an issue here (the same issue has been posted in the ios-client repository).

After opening Netbird ios-client on my iPhone and switching to other apps, Netbird ios-client seems to automatically close and disconnect.

I don't find an option in the iPhone settings for the Netbird client to keep refreshing in the background. Sadly, this affects the network I use netbird on my iPhone.

I don’t know if anyone has encountered a similar situation.

How to solve it?

To Reproduce

Steps to reproduce the behavior:

  1. Open Netbird ios client on my iPhone
  2. Click ‘Connect’ and see that the status shows Connected
  3. Switch to other apps to use
  4. After about 10 seconds, switch back to the Netbird ios client and it will display as Disconnected

Expected behavior

Netbird ios client can be in Connected state.

Are you using NetBird Cloud?

self-host.

NetBird version

netbird version

ios-client 0.0.3
ios 17.4.1

NetBird status -d output:

Not applicable in ios-client

Screenshots

20230329netbird-ios-client-issue1899.mp4

image

Additional context

netbirdio/ios-client#9

@jiangslee
Copy link
Author

EXC_RESOURCE -> NetbirdNetworkExtension[5634] exceeded mem limit: ActiveHard 50 MB (fatal)

I connected to my iPhone 12 and got the console log. It seems that my iPhone 12 has insufficient running memory, causing the kernel to kill the background process.

image image

@mlsmaycon
Copy link
Collaborator

Hello @jiangslee, this shouldn't be the case. To help us understand better the case, can you update the app to the latest version, enable trace logs, and export them by accessing the Advanced menu of NetBird's app?

@mlsmaycon mlsmaycon reopened this May 11, 2024
@jiangslee
Copy link
Author

Hello @mlsmaycon, Thank you very much for paying attention to this problem of mine.

I have updated to the latest version 0.0.4 and enabled Trace Logs, but I did not see any logs file.

image
image

@mlsmaycon
Copy link
Collaborator

You need to click on share logs, that will let you choose a path in your device to store the logs which then you can use to share them with us.

@jiangslee
Copy link
Author

The console Logs show that there are some deny records, but I was not prompted for authorization.

Do I need to enable any settings on my iPhone?

image

@jiangslee
Copy link
Author

EXC_RESOURCE -> NetbirdNetworkExtension[6591] exceeded mem limit: ActiveHard 50 MB (fatal)

image

@jiangslee
Copy link
Author

jiangslee commented May 11, 2024

**choose a path in your device to store the logs **
sorry , I just got it

@jiangslee
Copy link
Author

@mlsmaycon I’ve sent you the log file on Slack

@KortanZ
Copy link

KortanZ commented May 14, 2024

Same problem. IOS app become quite unusable these days. I can't recall since when, maybe after upgrade IOS version to 17.4, connection will lost when netbird app are background. Repeat switch foreground reconnect and switch background auto disconnect 3 or 4 times, connection seems could stable for a while. Situation became worse recently, needs more retry.

@jiangslee
Copy link
Author

jiangslee commented May 14, 2024

@KortanZ How many peers you have?
The temporary solution is to modify the peers accessible to the iPhone in Access Control Prolicies. Currently, my iPhone only allows 7 peers to communicate with each other. After switching to the background, the normal connection can still be maintained.

I have sent the logs to the Netbird team via slack, hoping they can find a solution.

In addition, I searched for relevant information. The possible reason is that network extension (tunnel) has memory limitations in iOS.
https://developer.apple.com/forums/thread/73148?page=2

for tunnel providers it seems to be 50 MB now.
Indeed. That’s a big bump!

Anyway, here’s what I see on iOS 15.0:

Provider Limit (MiB)
packet tunnel 50
app proxy 15
filter control 12
filter data 6
DNS proxy 15
app push 24
And, just so we’re clear:

IMPORTANT These limits have changed in the past and may well change in the future. I'm posting them to assist in your debugging. You should not hard code knowledge about these limits into your code. The only way to ensure that your provider can run within the system's memory limits is to thoroughly test it on a wide range of device and OS combinations.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

@KortanZ
Copy link

KortanZ commented May 14, 2024

Really thanks for help! @jiangslee

How many peers you have?

total peers are around over 20, active peers may around 4 to 10.

And i just upgrade ios to version 17.5, and situation is way much better. Connection will last a long period and only disconnet if app go background for quite a while. May be something wrong with my own server's reverse proxy configurition which cause gRPC timeout. I'm using Caddy with a really simple config. I'll use official nginx config to have a try to see if there any different happened.

@jiangslee
Copy link
Author

@pascal-fischer Thanks for your hard work.

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

No branches or pull requests

3 participants