netbird icon indicating copy to clipboard operation
netbird copied to clipboard

ios-client cannot be in Connected state after switching to the background.

Open jiangslee opened this issue 1 year ago • 12 comments

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

https://github.com/netbirdio/netbird/assets/27892476/ebe8dfc9-0e90-45a3-8fa6-4444b2bd641e

image

Additional context

https://github.com/netbirdio/ios-client/issues/9

jiangslee avatar Apr 29 '24 03:04 jiangslee

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

jiangslee avatar May 11 '24 03:05 jiangslee

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 avatar May 11 '24 08:05 mlsmaycon

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

jiangslee avatar May 11 '24 10:05 jiangslee

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.

mlsmaycon avatar May 11 '24 10:05 mlsmaycon

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 avatar May 11 '24 10:05 jiangslee

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

image

jiangslee avatar May 11 '24 10:05 jiangslee

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

jiangslee avatar May 11 '24 10:05 jiangslee

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

jiangslee avatar May 11 '24 10:05 jiangslee

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.

KortanZ avatar May 14 '24 03:05 KortanZ

@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"

jiangslee avatar May 14 '24 04:05 jiangslee

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.

KortanZ avatar May 14 '24 08:05 KortanZ

@pascal-fischer Thanks for your hard work.

jiangslee avatar May 18 '24 06:05 jiangslee