ProtonVPN / linux-app

Official ProtonVPN Linux app
https://protonvpn.com/download-linux
GNU General Public License v3.0
403 stars 64 forks source link

High memory usage after several hours of use #49

Open brendenhoffman opened 2 years ago

brendenhoffman commented 2 years ago

I am using arch with the app installed through the chaotic aur. I started the app roughly around 3pm yesterday, put the pc to sleep at 5:30pm, and at 9am the next morning protonvpn was using 1.8GB of ram. I did use some intense webpages, such as reddit, youtube, and outlook webmail, but at the time I was running out of memory my browser was only using a little under 500mb on my current tab, which was outlook during a refresh. My pc only has a little over 5gb of ram, so I really can't afford to have programs taking up so much memory. On a bit of a side note, I used to use the cli app, but recent builds have made the cli and gui conflicting packages, at least when using the precompiled binaries from the chaotic aur. I don't think this was an issue when I was using the cli app through a script to autostart it.

Jakethethird commented 2 years ago

Reported here on Reddit also.

calexandru2018 commented 2 years ago

Hey @Jakethethird

It's something that we're aware of and are working on.

Victor239 commented 2 years ago

Yeah I found the app had increased to 4GB usage today after putting my laptop to sleep yesterday.

nlynzaad commented 2 years ago

Hi @calexandru2018,

I've been monitoring the releases waiting for a patch. The changelog for version 1.5 mentions the memory leak has been resolved.

This does seem better, I unfortunately do not have the measurements from last week but at some point it was sitting at close to 1.5GB last week after a couple of hours. Unfortunately it does seem that there is still some leakage happening on the gui app.

Started the gui app after a clean restart took htop measurement and roughly 1h20 later checked again and memory usage was up from 190MB to 350MB.

image

image

image

This is on Manjaro using kernel 5.14.13 and kde plasma 5.23.1

calexandru2018 commented 2 years ago

Hey @dragonhelios

thanks for the feedback. So before the patch the GUI would start at around 440Mb and after 1h consumer around 1Gb of RAM. This new patch makes so that the GUI starts at around 140Mb and after 1h hover at around 300Mb.

well be closely monitoring the situation to understand if there are anymore such spikes of high RAM usage. As of now there shouldn’t be.

nlynzaad commented 2 years ago

thanks. I will advise if anything out of the ordinary appears.

nlynzaad commented 2 years ago

Issue is definitely still there, although as mentioned before it is much better, after having the app running now for 2 days and 20 hours and intermittently connecting and disconnecting memory usage is sitting at 1.35GB.

asorel1942 commented 2 years ago

Hello, Unsure of current status of this issue but I wanted to note that I am also seeing high RAM usage with the GUI app--currently experiencing 1.5 GB of usage after 5 day's uptime.

ProtonVPN: v1.7.0 (library: v3.8.0 / api-client: v0.7.1)

lzunsec commented 2 years ago

Same here. I think this app should be in Rust. If it still has memory leaks then probably it has memory vulnerabilities. Also I don't know why it does so much disk reads and writes, it should do none.

Also, why it takes literally 2 minutes to load the VPNs when I boot my PC?

lzunsec commented 2 years ago

ProtonVPN: v1.8.0 (library: v3.9.0 / api-client: v0.7.1)

ubuntu 22.04

my suggestions: change this app to Rust and use flutter instead of GTK

CodeDead commented 2 years ago

my suggestions: change this app to Rust and use flutter instead of GTK

Rust sounds good but Flutter... no. Flutter uses GTK for Linux, so what would that solve? Nothing. A simple webview with something like Tauri for your frontend is more than sufficient.

lzunsec commented 2 years ago

Flutter uses GTK just for rendering the opengl stuff. Tauri would consume a lot of RAM. Flutter is very very modern for graphics, with 60fps animations, and I believe Proton is redesigning and wants to looks beautiful. Please, no JavaScript, no webview, no 500mb ram just for displaying a web interface.

That's why Canonical is moving to Flutter, it's the best option.

-------- Mensagem Original -------- Ativo 27 de mai. de 2022 20:26, CodeDead escreveu:

my suggestions: change this app to Rust and use flutter instead of GTK

Rust sounds good but Flutter... no. Flutter uses GTK for Linux, so what would that solve? Nothing. A simple webview with something like Tauri for your frontend is more than sufficient.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

CodeDead commented 2 years ago

Flutter uses GTK just for rendering the opengl stuff. Tauri would consume a lot of RAM. Flutter is very very modern for graphics, with 60fps animations, and I believe Proton is redesigning and wants to looks beautiful. Please, no JavaScript, no webview, no 500mb ram just for displaying a web interface. That's why Canonical is moving to Flutter, it's the best option. -------- Mensagem Original -------- Ativo 27 de mai. de 2022 20:26, CodeDead escreveu:

my suggestions: change this app to Rust and use flutter instead of GTK Rust sounds good but Flutter... no. Flutter uses GTK for Linux, so what would that solve? Nothing. A simple webview with something like Tauri for your frontend is more than sufficient. — Reply to this email directly, [view it on GitHub](#49 (comment)), or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Tauri doesn't consume a lot of RAM. Tauri is probably the most performant option and you do not need to write a single line of JavaScript to get it to work. I think you might want to look into it first: https://tauri.studio/

Anyway, neither of us are the developers of this project and ProtonVPN is a private company, they can do whatever they like with their project.

lzunsec commented 2 years ago

I agree, Tauri is not bad, but still Flutter is faster and consumes much less RAM. And web is not meant for apps so it makes sense to use a solution that will work everywhere and with the least amount of ram. It's sad that RAM always grows but apps always keep up with the usage, so we can never win.

-------- Mensagem Original -------- Ativo 27 de mai. de 2022 20:32, CodeDead escreveu:

Flutter uses GTK just for rendering the opengl stuff. Tauri would consume a lot of RAM. Flutter is very very modern for graphics, with 60fps animations, and I believe Proton is redesigning and wants to looks beautiful. Please, no JavaScript, no webview, no 500mb ram just for displaying a web interface. That's why Canonical is moving to Flutter, it's the best option. -------- Mensagem Original -------- Ativo 27 de mai. de 2022 20:26, CodeDead escreveu:

my suggestions: change this app to Rust and use flutter instead of GTK Rust sounds good but Flutter... no. Flutter uses GTK for Linux, so what would that solve? Nothing. A simple webview with something like Tauri for your frontend is more than sufficient. — Reply to this email directly, [view it on GitHub](#49 (comment)), or unsubscribe. You are receiving this because you commented.Message ID: @.***>

Tauri doesn't consume a lot of RAM. Tauri is probably the most performant option and you do not need to write a single line of JavaScript to get it to work. I think you might want to look into it first: https://tauri.studio/

Anyway, neither of us are the developers of this project and ProtonVPN is a private company, they can do whatever they like with their project.

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you commented.Message ID: @.***>

CodeDead commented 2 years ago

...but still Flutter is faster and consumes much less RAM.

Can I ask what benchmarks you base this on @lzunsec ?

lzunsec commented 2 years ago

The only reason tauri has a smaller build size than electron or even flutter is because it uses the native browser, but the amount of crazy JS frameworks you have to insert to make something work is enormous so the RAM grows really fasy. But a fresh flutter app already has half the ram consumption, and comes with all the frameworks for animations and etc https://github.com/Elanis/web-to-desktop-framework-comparison. Once you add the equivalent in Tauri you get a slack-like app with 100s of mb of consumption for a simple chat app.

Also Flutter uses GTK on Linux just as a opengl display, so no GTK weirdness or anything needed

-------- Mensagem Original -------- Ativo 27 de mai. de 2022 20:38, CodeDead escreveu:

...but still Flutter is faster and consumes much less RAM.

Can I ask what benchmarks you base this on @.***(https://github.com/lzunsec) ?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

CodeDead commented 2 years ago

You don't need to add or write JS or use JS frameworks in Tauri. Rust is sufficient. It has the option to work with JavaScript, but it is not required.

In addition, the comparison you provided is incomplete.

pypeaday commented 1 year ago

I just dropped this into the reddit thread as well: I believe this locked up my computer today pretty hard... ssh in a pkill all the protonvpn processes (why were like 7?) and then I was able to get back in...

OS: Pop_OS! 22.04

ProtonVPN GUI Client: v1.12.0 (library: v3.14.0 / api-client: v0.7.1)

distbit0 commented 1 year ago

I am also experiencing this issue. Has lead me to have to stop using pvpn for the time being. 2gb+ of ram usage and sometimes high cpu usage after a day or so of being on. Not worth it for me. Would be awesome to see this fixed.

calexandru2018 commented 1 year ago

Hey all

Thanks you for raising this point. We're are totally aware of this issue but we won't be fixing it, as we're currently working on the new linux app. In the meantime, if you kill the GUI process after establishing the connection you can still have a VPN connection running, ks and the re-connector since those are embedded into NM. This way you'll be able to:

lattice0 commented 1 year ago

I hope the new app is Flutter based for cool animations and effects, with a Rust backend for no memory leaks

acidghost commented 1 year ago

@calexandru2018 Its is kind of criminal to advertise a Linux client that you know is not working at all and is full of bugs.. You must add a disclaimer to your download pages to alert people that they're going to install buggy abandonware as a VPN client.

You have also not been able to provide any kind of roadmap to a fix for this situation for almost an year, all the while taking money from Linux users.

I'm starting to regret my switch to Proton. Utterly shameful!

snex commented 1 year ago

I am using the Linux client (v1.12.0, Ubuntu 22.04) and it also has abnormally high RAM usage.

cogitech2 commented 1 year ago

I am also using the Linux client (v1.12.0 (library: v3.14.0 / api-client: v0.7.1) on OpenSUSE Tumbleweed. RAM usage starts off at 400MB and climbs steadily well beyond 1GB. Yesterday is was sucking 1.3GB ... ridiculous!

cogitech2 commented 1 year ago

When I typed the above message, RAM usage was 399MB. 6 minutes later, it is 501MB. Not joking.

cogitech2 commented 1 year ago

I found a half-baked solution.

Since the Linux ProtonVPN client is basically just GUI that allows one to easily configure and initiate an OpenVPN connection to their service, all you need to do to solve the memory consumption issue is to kill the protonvpn process and leave the openvpn process running.

For those like me who are only moderately adept at linux, I will show how to do this:

First, open a terminal and find all the "proton" processes:

paul@openSUSE-tw:~/> ps -aux|grep proton paul 13585 0.0 0.0 6516 2304 pts/0 S+ 13:04 0:00 grep --color=auto proton paul 27167 1.9 7.3 2627512 1160336 ? Sl 09:08 4:37 /usr/bin/python3 /usr/bin/protonvpn nm-open+ 27561 2.5 0.0 13380 8448 ? S 09:09 6:02 /usr/sbin/openvpn --remote 66.115.146.172 80 udp --explicit-exit-notify --remote 66.115.146.172 51820 udp --explicit-exit-notify --remote 66.115.146.172 4569 udp --explicit-exit-notify --remote 66.115.146.172 1194 udp --explicit-exit-notify --remote 66.115.146.172 5060 udp --explicit-exit-notify --remote-random --comp-lzo no --connect-timeout 20 --nobind --dev proton0 --dev-type tun --cipher AES-256-CBC --data-ciphers AES-256-CBC --auth SHA512 --auth-nocache --tls-auth.....

As you can see, PID 27167 is the main protonvpn GUI process (bold). You can also see the openVPN process below it, which is the actual process doing the work of maintaining the VPN connection.

The solution is simply:

sudo kill -9 27167

The result:

paul@openSUSE-tw:~/Downloads> ps -aux|grep proton paul 15457 0.0 0.0 6516 2304 pts/0 S+ 13:08 0:00 grep --color=auto proton nm-open+ 27561 2.5 0.0 13380 8448 ? S 09:09 6:12 /usr/sbin/openvpn --remote 66.115.146.172 80 udp --explicit-exit-notify --remote 66.115.146.172 51820 udp --explicit-exit-notify --remote 66.115.146.172 4569 udp --explicit-exit-notify --remote 66.115.146.172 1194 udp --explicit-exit-notify --remote 66.115.146.172 5060 udp --explicit-exit-notify --remote-random --comp-lzo no --connect-timeout 20 --nobind --dev proton0 --dev-type tun --cipher AES-256-CBC --data-ciphers AES-256-CBC --auth SHA512 --auth-nocache --tls-auth ... paul 27592 0.0 0.1 33168 18812 ? Ss 09:09 0:00 /usr/bin/python3 /usr/lib/python3.10/site-packages/protonvpn_nm_lib/daemon/dbus_daemon_reconnector.py

The openvpn process continues, and you get all that RAM back.

The downsides are:

snex commented 1 year ago

Proton also has a CLI client that doesn't seem to have the memory issues. It also lets you do things like choose servers, enable/disable killswitch, etc. Not perfect but it works.

cogitech2 commented 1 year ago

Proton also has a CLI client that doesn't seem to have the memory issues. It also lets you do things like choose servers, enable/disable killswitch, etc. Not perfect but it works.

Hey thanks! I had no idea about that. I will check it out for sure.

cogitech2 commented 1 year ago

CLI works great!

LordVltor commented 1 year ago

ProtonVPN Free user here on Mint XFCE 21.1. My PC almost never sleeps nor gets turned off. Proton GUI ramps up to over 2GB of RAM in just a couple hours, usually around 2.4-2.5. Don't remember havin' seen it above that but could have happened. I pack 32GBs of RAM now, so isn't much of an issue, but when it hits values "too high" and I have an instant of time, I just Terminate (killing doesn't work) ProtonVPN and all of its instances and reboot it. I don't like havin' to shut down and restart a security feature, though. I'm not a coder, else I'd help, but if I can do anything to drop useful data to help fixing this memory leak, I'd be glad to.

cogitech2 commented 1 year ago

ProtonVPN Free user here on Mint XFCE 21.1. My PC almost never sleeps nor gets turned off. Proton GUI ramps up to over 2GB of RAM in just a couple hours, usually around 2.4-2.5. Don't remember havin' seen it above that but could have happened. I pack 32GBs of RAM now, so isn't much of an issue, but when it hits values "too high" and I have an instant of time, I just Terminate (killing doesn't work) ProtonVPN and all of its instances and reboot it. I don't like havin' to shut down and restart a security feature, though. I'm not a coder, else I'd help, but if I can do anything to drop useful data to help fixing this memory leak, I'd be glad to.

Nice of you to offer help, but I don't think the ProtonVPN developers are engaged with this issue at all. The best solution for us end users is the CLI, which has no memory issues at all and isn't very difficult to get running (more difficult than the GUI for some users, but not terrible).

luxumbra commented 1 year ago

Just gone back to using the CLI after noticing the crazy high ram usage from the GUI. I always did use the cli but that started to get flaky and I switched to the GUI a few months ago but since noticing the ram issues, I'm back with the trusty cli. 💪🏻 Kind of expect more from the official application as a long standing subscriber to Visionary

calexandru2018 commented 1 year ago

Hey all, we've released an alpha version not long ago which should address the issue with memory consumption (amongst other things), please feel free to give it a try and provide some feedback: https://protonvpn.com/support/linux-prerelease/

Note: we've tested this on a very narrow and specific distros and DE, so please have that in consideration.

Barltarman commented 1 year ago

I've been running the alpha (4.0.0a5) for a couple of weeks now and it's looking pretty good, memory issue appears to have been resolved.

Ubunutu 22.04.2 Gnome 42.5 on X11

jthornton-0 commented 1 year ago

In addition to @Barltarman's comments, I was experiencing this issue and downloaded the alpha release as suggested - problems have instantly went away, hopefully it stays like this! Give the alpha version a try and see if it solves the issues too.