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

Tauri App High CPU Usage When Clipboard Notification is Shown #701

Open
tillmann-crabnebula opened this issue Apr 12, 2023 · 9 comments
Open

Comments

@tillmann-crabnebula
Copy link

The Tauri application consumes 100% CPU usage on one core, when the clipboard notification is shown.
Once dismissed or expired the CPU usage drops instantly.

Padloc v4.2.0 and reproduced on Arch/Ubuntu 22.04 with Gnome in a virtual machine.

@BrunoBernardino
Copy link
Contributor

Hey @tillmann-crabnebula there were some Tauri updates between 4.2.0 and 4.3.0, have you tried with 4.3.0? You can find it here.

@tillmann-crabnebula
Copy link
Author

Hey, I just tested this with 4.3.0 and I could reproduce the behavior.
I found the webkitgtk process to take the high CPU usage once the clipboard countdown is shown.

@BrunoBernardino
Copy link
Contributor

Thanks @tillmann-crabnebula !

@JonasKruckenberg is there anything we can do to mitigate this? The element is pretty simple and uses a setTimeout.

@JonasKruckenberg
Copy link
Contributor

JonasKruckenberg commented Apr 20, 2023

Interesting! I would need to do some testing to know what's going on but at a cursory glance this looks a bit like a webkit bug?
Like either a spinlock (which would be weird) or some recursive scheduling of a timeout maybe 🤔 This is a bit intriguing nonetheless so i'll give it a look tomorrow 😉

@JonasKruckenberg
Copy link
Contributor

Okay so update: While I haven't been able to test on Linux and in the context of a Tauri app I have been running the web version of padloc on my m2 macbook pro, where it also reports excessive CPU usage related to timers (the idle app shouldn't take up 32% of my CPU time on an m2 macbook pro 😅😂)
While i'm not an expert on lithtml it seems like the app is re-rendering a lot and maybe? it's causing the timeout to be rescheduled on every render?
I have tested in chromium where it seems this isn't an issue.

@BrunoBernardino
Copy link
Contributor

What do you think @MaKleSoft ? You're the lit-html expert here!

@MaKleSoft
Copy link
Collaborator

First off, the element in question is pl-clipboard, not pl-notification like Bruno said. Still, it's a pretty basic component though and although it uses setInterval, the interval duration is set at 1 second, so that certainly shouldn't take up that many resources.

Unfortunately I couldn't reproduce @tillmann-crabnebula's problem with the clipboard notification, but I do also see a ~30% CPU load for the idle app in Safari on my M2 Air, so there's definitely something wrong there. At first glance, it looks like the pl-totp element might be the culprit. I do remember there being some performance issues with that one in the past, which I thought we had fixed, but maybe the fix simply didn't work in Safari. Gonna have to dig a little deeper on that. @JonasKruckenberg Do you happen to have a lot of TOTP fields in your vaults?

@JonasKruckenberg
Copy link
Contributor

Yeah I think most of my fields should include totp data so about 20ish

@tjmaru
Copy link

tjmaru commented Feb 9, 2024

Hello,
Seems to me I faced with a similar issue with overloading CPU.
I've configured padloc on my arm64 instance with 4 cores and 24GB of RAM. (for details it's a VM on Oracle Cloud).
For test purposes, during adding a 2FA for the account using TOTP, on the step of confirming 6 dig code the CPU load dramatically increased up to 100% and padloc-server never answered until I restart it.

Padloc works in docker container without any specific limitation on CPU/Mem.
In this installation Padloc was empty.
Process which consume CPU in my top is node /padloc/packages/server/node_modules/.bin/ts-node src/init.ts

BTW, adding a hardware key is works fine. I'm using google titanium USB key.

UPD: the same issue I have with the x86_64 arch on ubuntu 22.

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

No branches or pull requests

5 participants