johnlindquist / kit

Script Kit. Automate Anything.
https://scriptkit.com
MIT License
3.91k stars 138 forks source link

Fresh install has high idle CPU on Windows 11 #1457

Open panzerchris opened 7 months ago

panzerchris commented 7 months ago

I did a fresh install of Kit on Windows 11 and was surprised that the idle CPU is quite high:

image

The application was not in the foreground and I tried restarting the application to see if that would help. I also suspended script and file watchers and that also didn't help. Ran a repair installation and the result was the same after the application restarted.

Checked the application logs (kit.log, main.log, update.log) and didn't see anything that looked particularly off such as the log regularly being written to. The developer tools were likewise fairly empty and the performance monitor didn't indicate high load, so I don't think it's that specifically.

CPU: AMD Ryzen 5 5600X 6-Core Processor OS: Windows 11 Pro 23H2 22631.3447 ScriptKit: 2.3.0 Node: v18.18.2 (LTS)

Edit: Dug into this a little more with Process Explorer and the main culprit was NvMessageBus.dll that seems to come from Nvidia. I killed the thread and nothing untoward happened and everything still rendered fine just without the high CPU utilization.

johnlindquist commented 7 months ago

Hey Chris,

Try quitting Kit, then open ~/.kit/db/app.json and toggle disableGpu: true, then open Kit again.

I haven't been able to reproduce, but others have reported that this fixes it

panzerchris commented 7 months ago

Weirdly that does not fix it for me:

{
  "version": "0.0.0",
  "openAtLogin": true,
  "previewScripts": true,
  "autoUpdate": true,
  "tray": true,
  "authorized": false,
  "searchDebounce": true,
  "termFont": "monospace",
  "convertKeymap": true,
  "cachePrompt": true,
  "mini": false,
  "disableGpu": true,
  "disableBlurEffect": false
}

Appreciate this is probably not an easy one to debug or replicate given the Nvidia drivers also seem to be at play here. I have the latest version of those installed. If I find a bit more time I'll pull down the source and dig around. Really love ScriptKit, use it on my MacBook and figured why not have it on all my machines?!😄

johnlindquist commented 7 months ago

Thanks, I'd be super grateful for any info you come across.

patrikzudel commented 6 months ago

I've been having the same issue for a long time (My guess is from the release of 2.3.0), forced me to stop using kit. disableGpu: true didn't help. Funnily enough, I have the exact same processor.

Specs: Ryzen 5 5600X 64GB DDR4 RAM RTX 3080 (Driver version - 551.86) ScriptKit: 2.3.0

image

JosXa commented 6 months ago

No issues on my AMD card

panzerchris commented 6 months ago

I've been having the same issue for a long time (My guess is from the release of 2.3.0), forced me to stop using kit. disableGpu: true didn't help. Funnily enough, I have the exact same processor.

Specs: Ryzen 5 5600X 64GB DDR4 RAM RTX 3080 (Driver version - 551.86) ScriptKit: 2.3.0

image

We also have the same GPU. I also have a 3080. I wasn't yet able to get this building on Windows but plan to take a second look at the weekend if I can.

LatentArchitect commented 6 months ago

I also have this same issue and I ALSO have the same CPU (AMD Ryzen 5600X). I did try "disableGpu": true, but it didn't make a difference for me either. I only have a 1080Ti in my machine but my GPU is completely unaffected, it's just my CPU sitting at a constant 15% usage from Kit.

I am not super well versed in programming (kit is something I am hoping to use as a tool to learn, actually). But if you guys have any recommendations or instructions, I am definitely hoping to assist and/or provide whatever I can.

Love Script Kit and honestly still gonna continue to use it even if it puts my CPU 10°C higher idle temp lol.

panzerchris commented 6 months ago

Thanks for reporting more hardware configurations! Starting to think the common denominator is Nvidia after looking at Process Monitor. The high CPU thread is related to the Nvidia driver but I've no idea why that's the case.

I have been wanting to dig into this further but haven't had much time. I was also struggling to build kitapp locally. Unfortunately @nut-tree/* packages are no longer on npm. However, I nearly managed to get a complete build over the weekend so I hope to see if I can narrow this down.

johnlindquist commented 6 months ago

Apologies I haven't been helpful here.

I'm making sure the next build allows you to toggle every possible setting so we can narrow this down further. That @nut-tree package being deleted + work/travel halted progress for a bit, but I'm hoping to have a much more customizable build by the end of the month.

panzerchris commented 6 months ago

In what is probably the least scientific method ever, I renamed 'Kit.exe' to 'Kit2.exe' in the folder C:\Users\<Username>\AppData\Local\Programs\kit and the high idle CPU goes away. Everything still works much the same, except the process ends up appearing as electron.exe rather than Kit.exe. Why this helps I'm not sure - it doesn't make a lot of sense to me at this point.

johnlindquist commented 6 months ago

It's probably too late to tell, but does the kit.log look any different when you launch the renamed version?

panzerchris commented 6 months ago

logs.zip. I did this multiple just to be sure I'm not imagining things. Here's logs from two runs of Kit.exe vs Kit2.exe. Logs don't indicate much different from what I can tell though. I'd say it looks pretty similar both times.

LatentArchitect commented 5 months ago

Are there any updates on this by chance? I have been working with more intensive applications as of the last month and in order to keep my CPU from blasting off to 85-90 degrees, I can't use script kit :/

I can provide whatever you might need for reference (though I might need a link to instructions or guides for anything in depth)

johnlindquist commented 5 months ago

@LatentArchitect I'm pushing hard to get v3 out which will have way more tweakable settings to debug issues like these. I'm even trying to figure out a "debug perf" mode where it would automatically turn off settings and watch cpu/gpu until it figures out what the root cause is.

I'm hoping to have it out by the end of June.

LatentArchitect commented 5 months ago

Oh ok! Well hell yeah! Well I look forward to the update and I seriously appreciate all the effort and dedication!

And thanks for replying so quickly!

Love this app and community so far! 🤘

Robot1me commented 3 months ago

Hi, I'm not using this software, but like to provide some context since this is the top Google result for this problem. I noticed this CPU usage issue with NvMessageBus myself, and it can be linked to the Nvidia Display Container LS service (name is NVDisplay.ContainerLocalSystem). On an old system of mine, I had to make sure that Nvidia's container service does always run, otherwise it can happen. Strangely enough though, even the reverse can be the case. For example, on my new computer when I run a game inside Sandboxie, games will also have this NvMessageBus.dll inside their processes and fully utilizing a single core for nothing. When I turned off the Nvidia container service, games inside Sandboxie then didn't suffer from this CPU usage bug.

So my suggestion: Try to check if enabling and disabling the service makes a difference after restarting the application. For testing it's enough when you open "services.msc" from the start menu, and rightclick the service to either start or stop it.

Trugamr commented 2 months ago

Thanks, @panzerchris! Renaming the executable and shortcut seems to have fixed the issue on my end. I also tried @Robot1me's tip of stopping the NVIDIA Display Container LS service before launching Kit, and that worked too, though it's just a temporary solution—if Kit starts with the NVIDIA service running, the problem comes back.

For context, here are my machine specs, which are pretty similar to what others have mentioned: CPU: Ryzen 5600X GPU: NVIDIA RTX 3070 FE

Trugamr commented 2 months ago

Also, just wanted to add that based on my previous testing, adding "disableGpu": true to ~/.kit/db/app.json works, but only with the next version of Kit, not the current stable 2.3.0—at least for me.