proton-bridge
proton-bridge copied to clipboard
High CPU usage
Expected Behavior
Light CPU usage
Current Behavior
Extreme CPU usage for a few seconds whenever the bridge is in use by Mail.app: fetching mailboxes or emails.

Is this known/expected? Can I provide more info?
Related:
- https://www.reddit.com/r/ProtonMail/comments/azpl8u/protonmail_bridge_causing_very_high_cpu_use_and/
- https://www.reddit.com/r/ProtonMail/comments/f60utr/bridge_taking_up_300_or_400_cpu_while_wifi/
- https://www.reddit.com/r/ProtonMail/comments/jsso80/protonmail_bridge_causing_high_cpu_usage_fan/
- https://www.reddit.com/r/ProtonMail/comments/g60ebp/protonmail_bridge_cpu_usage_at_173_has_anyone/
Arch on latest Bridge 1.5; I'm having the same problem, except I don't need to have a client checking emails to experience the problem.
yes, same here, where the reason is that PMB re-dowloads thousands of emails. A fix is presumably on the way, but of course it is tedious and a waste of energy.
thanks all for reporting. yes, we are well aware of the problem and are working on the solution. will keep you posted here with any progress.
Seen this today on Debian bullseye with protonmail-bridge 1.5.2:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
7047 mdk 20 0 4795368 1.1g 1.0g S 513.3 7.3 85:25.73 protonmail-bridge
I happen a lot currently, I'm not monitoring it closely, but it happened at least 3 times during the last 5 minutes.
Feel also the process is a bit high in memory usage.
This is what the battery impact of ProtonMail looks like on my laptop for a couple minutes after using Mail.app. For reference, Safari doesn't go above 6.0 when using the actual ProtonMail website.
@angristan you can add "and Linux" at the end of the issue title ☹
On MacOS, protonmail bridge consumes almost 30-40% of my energy usage over a 12h period. Does it mean by battery last almost half as long as it otherwise would? If true, this leaves quite the sour taste...
On MacOS, protonmail bridge consumes almost 30-40% of my energy usage over a 12h period. Does it mean by battery last almost half as long as it otherwise would?
I understand it the same, yes :(
I can report equivalent behaviour on arch 5.10.6-arch1-1. Using OfflineIMAP for mail synchronization, the Bridge tends to spin up to ~500% (on my 8-thread CPU) every so often. Please let me know if I can provide any logs that would help you...
Same here. It has been CPU intensive for more than a week. Apple Mail on Mac-mini. Do you need logs?
Using like 600 megs of memory on my machine too. Pretty unfortunate, but I guess I'm back to using the webmail client for the foreseeable future.
From what I have heard in the replies to my bug reports, the issue is known and someone seems to be working on it. But given that this has been unchanged for almost a year now, I begin to fear that protonmail has decided that webmail is the most important way to work with it ... For all those of us who are not online all the time and who have to mangage several mail accounts, this is not an option.
I'm sure you all appreciate that the issue of high CPU usage is not straightforward to fix. First of all, Bridge is expected to consume a lot of resources during the initial sync - we want to have it done quickly and allow the users to use their email client without much delay, hence this part should be treated as expected behaviour. The problems starts when Bridge is not doing it as a one-off but when this becomes frequent behaviour. This is obviously not desired and frustrating to all of us. We identified a range of scenarios in which this happening - some are panic, some are related to fetch errors or, quite often, to expunge during not-uid fetch. Most of those problems are not clearly visible to the user and often just work when Bridge retries. We initially struggled to replicate some of them, just like with related https://github.com/ProtonMail/proton-bridge/issues/29. We managed to narrow down the problems though and a lot of fixes will be coming through in upcoming releases - some are already included in the recent 1.5.6, but a wider range will be coming in 1.6.x. Once we fix what we know is wrong, we will definitely reach out to gather what we've missed - but we hope it won't be much. Thanks for your patience guys.
Did you guys successfully fixed this -because on my system it appears so. Proton-bridge has been running for a few days and it reports no 12-hour power usage. Although if I keep an eye on it, then once in a while it peaks instantaneously to 140ish power usage to immediately drops to near zero. It used to do this also before, but -before- and cumulatively it would add up to 10-14 power usage over a 12h period which represented almost 30%-50% of my daily power usage. Now it shows "-" as the 12h power usage which I assume is equivalent to 0. I am not sure if my system is reporting it differently now, or if you have fixed it already? There has been an update or two since then.
Great to hear, but we're not done yet - more improvements to come shortly in 1.6.x. we're also working on introducing some metrics for internal builds, so that we could actually measure the performance. will keep this issues open until all the known problems are resolved.
I'm having the same issue: macos 10.14.6, apple mail v12.4, bridge v1.6.3. About once an hour my mail client decides it needs to re-download 10k emails, which then understandably causes the bridge to chew up a huge number of CPU cycles. But this is only a problem with the protonmail bridge. None of my other email accounts ever seem to re-download old emails.
After a week or two of testing, I can confirm that this behavior is still present in v1.6.3. Still, from user perspective I can see some progress (either high CPU load incidents take less time, or are less frequent, not sure about which one is the reason). Please keep up the good work! :+1:
thanks @petrmanek. what we're working on now is a new message builder and a connection manager - the former should ensure that the clients does't get confused by some of the messages that might not be rfc compliant; the latter will mitigate any potential connectivity problems (PM server > API > Bridge's IMAP > Client). no eta on be above just yet.
didn't mean to close this ;-)
Some news, according to top:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
273007 mdk 20 0 5838944 1.2g 1.1g S 521.9 7.8 5:10.33 proton-bridge
and:
$ ps -eo pid,lstart,cputime,cmd | grep proton
272994 Fri Apr 16 23:32:13 2021 00:00:00 protonmail-bridge
273007 Fri Apr 16 23:32:13 2021 00:10:25 /home/mdk/.cache/protonmail/bridge/updates/1.6.9/proton-bridge --launcher /usr/lib/protonmail/bridge/proton-bridge-launcher
As it's 9:34 AM the process has been started exactly 10 hours ago, and used 10mn of CPU (looks OK), and is using a lot of RAM.
I have had the same problem. But since version 1.8.3 it seems to be fixed. I'm running it since the release without turning it off and I haven't noticed any high CPU usage and 0 energy impact according to Activity Monitor.
System details: macOS 11.4, Macbook Air M1
Still have this issue, 550% CPU with PMB 1.8.3
macOS 11.2.3 Big Sur, Intel chip
Using 1.8.3:
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
624098 mdk 20 0 6202704 1.4g 1.2g S 0.0 9.0 24:56.93 proton-bridge
$ ps -eo pid,lstart,cputime,cmd | grep proton
624087 Thu Jun 10 17:47:04 2021 00:00:00 protonmail-bridge
624098 Thu Jun 10 17:47:05 2021 00:25:00 /home/mdk/.cache/protonmail/bridge/updates/1.8.3/proton-bridge --launcher /usr/lib/protonmail/bridge/proton-bridge-launcher
It's 06:01:12 PM so the process runs since ~15mn and ate 25mn of CPU, looks a bit high to me.
The RAM consumption looks a bit high to me too, does it stores all my emails in RAM?
With 1.6.9 previously, it consistently spooled up to 2000% CPU as reported by 'top', every minute or so.
Updated to 1.8.9, and now it is consistently at ~100-120% all of the time, and still rises up to 2000% sometimes, but this is maybe slightly less frequent than before. (maybe every 2-3 minutes instead of every minute).
Hopefully this can be improved sooner rather than later, this is really making the bridge untenable, especially on laptops. I don't care about using the webmail interface, and need some way of accessing via a traditional IMAP client. If the bridge is going to be this power hungry, I will unfortunately have to look for alternatives.
Update: After reading some of the Reddit threads linked above, I dropped my poll frequency in my email client (Evolution) to 15 minutes. Previously it was 2 minutes. This seems to have considerably improved the situation, I haven't seen a 2000% spike since I didn this (watching for about 10 minutes now), and the baseline 100% idle seems to have gone away too.
I'll keep an eye on this over the next few days and report back.
Unfortunately I can still report over-the-top CPU usage (like what @stellarhopper described) with v1.8.9 on my Thinkpad T590. Thus far I am mitigating by increasing the polling period but I would like to find a better solution as soon as possible.

macOS 12.2.1 latest bridge version
Same here. Still keeps happening with v2.1.0 on the latest Archlinux kernel (5.16.8-arch1-1).
@petrmanek @mapennell can you confirm that the initial sync finished, i.e. your mailbox is in full sync? also, could you confirm if no improvements with 2.1.1? if not, it would be great if you could contact support - we would like to see the logs.
@andrzejsza I can confirm that my entire mailbox appears to be in full sync. For due diligence, I am not sure how to be completely certain of this but the numbers of emails in individual folders match those visible online, and I have been using the bridge like this for several months now.
I would be happy to update you re: v2.1.1 once it becomes available on the AUR and possibly share logs with PM support.