zaneschepke / wgtunnel

An alternative Android client app for WireGuard VPN
https://zaneschepke.com/wgtunnel-docs
MIT License
789 stars 43 forks source link

[BUG] - Slowness #324

Closed freijon closed 1 week ago

freijon commented 1 month ago

Since a while I notice horrible performance with Wireguard. A speedtest shows I can only reach 0.35 Mbps. I downgraded to 3.4.8 and 3.4.7 which solves the problem.

zaneschepke commented 1 month ago

Hello! Could you share the model of your phone? I have been hearing reports of this on Redmi devices.

freijon commented 1 month ago

Sure. Added in description.

crimsonthunder commented 1 month ago

Same for me on Google Pixel 6. Android 15 Public beta latest App Version 3.5.1

zaneschepke commented 1 month ago

Thank you for the reports. I'll keep investigating. For now, the temporary fix would be to turn on the Amnezia backend. I've been told this fixes the issue.

mr-scrawley commented 1 month ago

Also affected on:

Rollback to 3.4.8 fixes restores performance to what the official wireguard app provides.

crimsonthunder commented 1 month ago

Thank you for the reports. I'll keep investigating. For now, the temporary fix would be to turn on the Amnezia backend. I've been told this fixes the issue.

Amnezia fixes the issue for me.

hudcap commented 1 month ago

New user here (great app btw - thanks!). I was only seeing an issue on mobile data, not wifi. I assumed it was a "me" issue, so I created a separate VPN for mobile data and tried changing the MTU, to no avail. Came back here and found this - Amnezia solved it, so I assume I'm bitten by the same bug.

TL;DR this issue only affected me on mobile data (Verizon via Red Pocket on a Moto One 5G Ace)

GeneralTDog commented 1 month ago

For Protocol: Same issue here (OnePlus 8T on lineage_kebab-userdebug 14 AP2A.240705.005 3d40349489 with wg-tunnel 3.5.1)

Using Amnezia worked as a workaround so far 👌

zaneschepke commented 1 month ago

If someone could try this debug build and let me know if it fixes the problem that would be great! https://cloud.zaneschepke.com/s/de2g3zJEAYd59nr --

I didn't really change much, but I suspect the issue could be related to the tunnel lib being built on my mac instead of on linux. For this build, I built the lib on linux which I hope will fix the issue.

The reason it is a cloud storage link instead of a prerelease on github is because I don't want to publish a new version of the library unless I am sure this fixes the issue. Without that being published, I can't generate a new build via my github pipelines.

freijon commented 1 month ago

The link doesn't work for me. Connection timed out.

zaneschepke commented 1 month ago

The link doesn't work for me. Connection timed out.

Gotcha! Try this one: https://github.com/zaneschepke/wgtunnel/releases/tag/speed-testing

freijon commented 1 month ago

I still have the issue with this build.

zaneschepke commented 1 month ago

I still have the issue with this build.

Thanks for testing. I'm sorry I would test myself but I am unable to reproduce this issue. Is there any improvement with this build? https://github.com/zaneschepke/wgtunnel/releases/tag/speed-testinv2

freijon commented 1 month ago

Thank you! I gave that new build a try, unfortunately the issue persists. However, while testing this I figured out that I only have the issue on mobile data, not on Wifi (as mentioned before by @hudcap). I even went back and tested both test builds again. It happens only with mobile data, Wifi works fine. Hope that helps.

zaneschepke commented 1 month ago

Thank you! I gave that new build a try, unfortunately the issue persists. However, while testing this I figured out that I only have the issue on mobile data, not on Wifi (as mentioned before by @hudcap). I even went back and tested both test builds again. It happens only with mobile data, Wifi works fine. Hope that helps.

Thank you so much! This should help me narrow down what is wrong with the build. Thank you again.

Gertjuh commented 1 month ago

Same issue here on a Poco F3. I can confirm that the problem is only on mobile data. I am also using the original Wireguard App with the same settings and that is working fine.

nillebor commented 1 month ago

I have the same problem with a POCO F3 with LineageOS 21. The speediest shows me download values of 0.3–0.6 Mbit. If I activate the kernel modules, I get the 40 Mbit in the download again. For me, the problem seems to be only with the download. The upload is the same with and without kernel module.

Another small problem: when the tunnel is activated, the VPN symbol (key) is not displayed in the status bar.

hb9eue commented 1 month ago

Same here:

I get around 300 kb/s

When turning on the Amnezia Backend this doubles to about 600 kb/s

When using WireGuard for Android v1.0.20231018 I get about 3Mit/s

Plopaplopa commented 1 month ago

Same here, Xiaomi Redmi 13C. Stuck at max 300ko/s since a few days. My phone is up to date. My girlfriend does not have the issue (Redmi 9S). I tried to reinstall the app and reconfigure the tunnel, reboot my Wireguard server, etc. I also tried using the official Wireguard app, it works fine.

Then I finally ended here, and tried the Amnezia solution, it fixed the problem.

Anyway, good luck with this bug, and thanks for this amazing app :)

hb9eue commented 4 weeks ago

I'm wondering about those which solved the issue by enabling amnezia. My WG Server is a Mikrotik, it does not support Amnezia, I only get about double the speed when enabling Amnezia which is still slow, especially when using apps which load map tiles like google or OSM. So sould enabling Amnezia on the client still solve the issue?

=> Never mind, tested again, now I get about 6Mbit/s with Amnezia enabled on the client, connected to a Microtik WG server not supporting Amnezia.

JanTijhof commented 3 weeks ago

I had the same issue as everyone above. Getting the apk for 3.4.8 from the Fdroid repo got the connection back to the previous speeds.

Device: Mi9T Rom: Evolution X on android 14 Version: 3.5.1 Network: mobile data

zaneschepke commented 3 weeks ago

Unfortunately, I am still unable to reproduce this issue. If anyone is able to test this version to see if it fixes the problem that would be great!

https://github.com/zaneschepke/wgtunnel/releases/tag/speed-test3

crimsonthunder commented 3 weeks ago

Testing it right now. Thank you for your continuous work!

Nosebear commented 3 weeks ago

For me the latest testversion isn't working. Still slow. Version 3.4.8 works fine. Hope you can figure out a solution. It's a great app. Thumbs up!

crimsonthunder commented 3 weeks ago

Sadly same for me. Still getting slowdowns ☹️

JanTijhof commented 3 weeks ago

No luck for me either. Greatly appreciating the work and test releases however!

DerDreschner commented 1 week ago

I have the same issue. The wireguard server is running on an Ubiquiti DreamMachine Pro and the app/wireguard tunnel on my Fairphone 4 is running in userspace (visible under support -> mode). Maybe that's important...?

zaneschepke commented 1 week ago

Does this issue only happen in userspace mode or does it it happen with kernel mode as well?

zaneschepke commented 1 week ago

I was unable to figure out what part of my fork on the original wireguard android lib was causing this slowness issue.

Considering Amenzia is already working properly, I change the default backend in 3.5.2 to be Amnezia and removed the userspace toggle option from the settings. Amnezia already has backwards compatibility and the same speeds as the original, official lib. I think this should effectively mark this issue as resolved. If there is any other strange behavior around this slowness issue, just let me know and we can reopen. Thank you all for your patience with this one!

crimsonthunder commented 1 week ago

Thank you for all your work!

DerDreschner commented 6 days ago

Does this issue only happen in userspace mode or does it it happen with kernel mode as well?

Uhm, I don't know how to use Wireguard on my phone with kernel mode. Or was that question asked towards the people who have no issues?

But as I didn't had any issues with Amnezia, I think it's a good option to use it as default backend. I looked into your code as well, but I have no experience with developing for Android to investigate it with a debug build on my phone.

zaneschepke commented 6 days ago

Does this issue only happen in userspace mode or does it it happen with kernel mode as well?

Uhm, I don't know how to use Wireguard on my phone with kernel mode. Or was that question asked towards the people who have no issues?

But as I didn't had any issues with Amnezia, I think it's a good option to use it as default backend. I looked into your code as well, but I have no experience with developing for Android to investigate it with a debug build on my phone.

Np! You have to have a rooted phone to use kernel mode. I was just asking in general if anyone was experiencing this issue in kernel mode.

dvalter commented 1 day ago

@zaneschepke I believe to have an idea about this issue.

wireguard-go d0bc03 commit has enabled GSO/GRO, which may cause significant packet loss on mobile network for some reason.

On the only phone (Pixel 5a) I've tested, this very bug wad present in wireguard-android as well, and reverting GRO/GSO in wireguard-go had fixed it for me.

zaneschepke commented 1 day ago

Thanks for this! Ill give this a try.