Shopify / theme-check

The Ultimate Shopify Theme Linter
Other
337 stars 95 forks source link

CPU running at 100% caused by theme check #622

Closed ComicDansMS closed 2 years ago

ComicDansMS commented 2 years ago

There is some sort of issue where one core of the CPU will start running at 100%, VS Code source control won't stop loading (not able to commit when this happens), and other search functions (ctrl+P) are slow or stop finding what you're looking for. I close VS Code to fix it but it will happen again in a few minutes.

I've found it is this extension due to it never happening when I'm not working on Shopify/liquid files, and disabling all related plugins except this one.

It happens across both my Macbook and my Linux (Manjaro) machine.

I'd love to give more information but this is as much as I can work out at the moment. It's been happening for at least a few weeks.

charlespwd commented 2 years ago

That's kind of an important thing to debug. Can you help me with the following?

  1. Is this from a theme-check or shopify CLI installation? (did you ever install theme-check separately? e.g. via gem install theme-check or brew install theme-check?)
  2. What is the output of the following commands?
    • $ shopify theme check --version
    • $ theme-check --version
  3. Is there any chance I could have a hand on the theme itself? (I am a Shopify employee under NDA) -> cp.clermont@shopify.com
ComicDansMS commented 2 years ago
  1. It's from the theme-check VS Code extension. I installed the extension through VS Code itself, not through CLI.

  2. $ shopify theme check --version returns Theme check version is 1.9.2. And $ theme-check --version isn't recognised as a command as I haven't installed that through the command line.

I'm positive it's related to the VS Code extension fixes the issue. It also happens across multiple themes which are based off Dawn. I'll be in touch via email, anyway.

ComicDansMS commented 2 years ago

**I'm positive it's related to the VS Code extension AS CLOSING IT fixes the issue.

charlespwd commented 2 years ago

Can you upgrade your Shopify CLI and try again? The latest version of theme-check is 1.10+

I have a vague feeling that we might have fixed this already.

ComicDansMS commented 2 years ago

Sorry for the late response.,

I upgraded Shopify CLI and I've found the problem still persists on both machines (macbook and linux/manjaro).

On the macbook, shopify theme check --version is currently 1.10.2.

According to Activity Monitor (on mac), it's the electron process that's becoming stuck at 100%.

charlespwd commented 2 years ago

Haven't gotten time to look at this yet but it is very much next in line.

I'm curious, we're not using electron so are you sure it's an electron process or is it the parent process that's causing this? Is VS Code built on electron?

In any case, that's something that's possible so I'll have to look into it.

Also,

ComicDansMS commented 2 years ago

Yes I believe VS Code is built on electron. The macbook was reporting it to be electron, where my Linux machine is reporting it to be Code (it just happened then on Linux and code was responsible for the CPU peaking).

- Does it happen every time you open a theme repo? I'd say it happens almost everytime, if not everytime. - Is there a .theme-check.yml file in there? Yes - Does it happen as soon as you open the theme or after a little while? It doesn't happen immediatey, but probably within ten minutes or so. - Is there anything about your workflow that you think is unconventional that I should be aware of? Not really. I fire up shopify theme serve in a terminal/console window and start working.

I'll try to keep an eye on it and update. I'm not doing as much Shopify development at this point in time so sometimes there are periods where I forget about this issue that's open.

ComicDansMS commented 2 years ago

I've had it happen again. It has been half an hour since restarting VS Code. I had liquid files open but never modified/saved them as I was working with stylesheets and it was ok. It only happened when I modified a liquid file and saved it.

For what it's worth, it's just one core that peaks at 100%.

ComicDansMS commented 2 years ago

@charlespwd any updates on this one? Another dev at work has had the same issue, so it's good to know it's not just me.

charlespwd commented 2 years ago

Yeah sorry my task has been taking a while 😅. We just launched https://github.com/shopify/prettier-plugin-liquid and it's been keeping me busy since march.

It's still second in queue. I'm going to do a round of bug fixes real soon.

ComicDansMS commented 2 years ago

I've just setup a new macbook and found this to carry over. Not sure if this would help at all, but this is some info from terminal on the process that's getting stuck..

3:33.36 /Applications/Visual Studio Code.app/Contents/Frameworks/Code Helper.app/Contents/MacOS/Code Helper --ms-enable-electron-run-as-node --inspect-port=0 /Applications/Visual Studio Code.app/Contents/Resources/app/out/bootstrap-fork --type=extensionHost --skipWorkspaceStorageLock

charlespwd commented 2 years ago

(sorry again, was on leave and could not work on this)

This is very weird. I've setup your theme, setup shopify CLI in a terminal window. Messed around a bit for a while and it has yet to happen to me.

Can you tell which child process is causing it to trip?

In htop for instance, you can press t to see a tree view of your processes and see what's happening.

I do see the CodeHelper part but there are so many. Mine is still sitting at 0% 😕

Just to be clear, here's my setup:

  "shopifyLiquid.trace.server": "verbose",
  "themeCheck.checkOnChange": true,
  "themeCheck.checkOnOpen": true,
  "themeCheck.checkOnSave": true,

With shopifyLiquid.trace.server set to verbose, you can then see the language server logs in VS Code's OUTPUT tab:

If it happens again, is there any chance you could copy the logs with that setting turned on and paste them on a gist that I could put my eyes on?