-
-
Notifications
You must be signed in to change notification settings - Fork 605
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
Intrinsic high CPU usage #2882
Comments
@falkoschindler it's possible. The login page in the example is wrapped into |
I'm in the same boat here. I'm wrapping the pages within a fastapi app and am noticing the same behavior where refreshes can solve the problem with every other refresh solving the problem. I checked the process handles and they are constant regardless of performance, so it's not spinning up any extra handles or dropping any handles there. I have a resize function tied to an aggrid inside the @ui.page('/'), but when i attach a timer to it, i'm not seeing a refresh rate above what you would expect, so the ui.on('resize') at least is registering events correctly. So i'm guessing there's a function in the routing that isn't being handled correctly. I have mine set up within a fastapi app and that index page is mapped with an async. I thought it might have been in the wrapper, but if it was a miscode then the functionality would remain regardless of refreshes. removing the async from the page def doesn't solve the problem either. Windows 10 |
@me21, @vickorian We're working on a fix for #2482, see PR #2867. |
@falkoschindler, @me21 seems to work. I'll run with this branch to make sure there aren't any major problems or weird bugs that i haven't seen yet. pip install git+https://github.com/zauberzeug/nicegui@refs/pull/2867/head |
Sure. It is included in 1.4.24, right? |
Description
I was running the example from https://github.com/zauberzeug/nicegui/blob/main/examples/authentication/main.py
The only change I made was adding
show=False
toui.run
invocation to avoid opening the browser window automatically.I found that after loading the page, occasionally the CPU usage of Python goes up to 12-14% on my laptop which is almost 1 CPU core out of 6. I also noticed that it can be more or less reliably triggered by refreshing the web page twice in quick succession (by tapping F5 key).
On subsequent page refresh the CPU usage goes down.
It's not 100% reproducible but like 80%.
My experiments were done on http://127.0.0.1:8080/login URL (I was not logged in).
It's not related to AuthMiddleware, as commenting out
app.add_middleware(AuthMiddleware)
line only made the issue harder to reproduce, but it's still happens if I refresh the page 10-20 times quickly by abusing F5 key.My laptop runs Windows 10 22H2 and NiceGUI was installed in a virtual environment (version 1.4.19).
The text was updated successfully, but these errors were encountered: