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

Trunk+VSCode keeps my coffee warm #287

Open
Oni-giri opened this issue May 19, 2023 · 13 comments
Open

Trunk+VSCode keeps my coffee warm #287

Oni-giri opened this issue May 19, 2023 · 13 comments

Comments

@Oni-giri
Copy link

Hello,

Thanks for the awesome "master-linter" - the UI/UX is great, it's very useful.

Just a little feedback, share by other dev friends : it's heavy on the processor, and we had to uninstall it (at least from VSCode) to solve the issue. After 5 minutes of code, compute usage would shoot to 100%, and my MacBook Air 2021 would get very, very warm.

I think the VSCode plugin is at fault, however the behavior persisted after I removed it, and stopped when I did a clean uninstallation. I reinstalled only the CLI tool after, which solved the problem.

Thanks for the good work, I hope this feedback helps :-)

@det
Copy link
Contributor

det commented May 31, 2023

Thanks for the feedback @Oni-giri! We are actively working on reducing the resource usage of the vscode extension and will be sure to update this ticket when that work makes its way into a release.

@Oni-giri
Copy link
Author

Oni-giri commented Jun 16, 2023

Thanks, I think there's a bug where trunk launches several instances of itself randomly. See the problem:

Capture d’écran 2023-06-16 à 17 22 53

I hadn't used it at all before, just had VS Code open (without the extension). I'll have to uninstall it yet again.

@TylerJang27
Copy link
Collaborator

Thanks for posting the screenshot. That sort of information is definitely helpful to us. Can you answer a few other questions:

  1. What trunk cli version are you running (trunk --version)?
  2. When you took that screenshot were you running trunk in multiple repos or just one?
  3. Do you have anything in the actions enabled section of your .trunk/trunk.yaml? Trunk can be configured to run using git-hooks, which will also start linting in the background. It's possible that's what happened here.

We're still actively working on trying to make resource usage less of a problem in general, and we will keep you updated when we have a fix you can try!

@Oni-giri
Copy link
Author

  1. Version 1.5.1
  2. Just one
  3. Here are the actions:
actions:
  disabled:
    - trunk-announce
    - trunk-check-pre-push
    - trunk-fmt-pre-commit
  enabled:
    - trunk-upgrade-available

@laurit17
Copy link
Contributor

Hi @Oni-giri, we have made a lot of changes since 1.5.1 so we recommend you stay up to date if possible.

In 1.11.1, we made some optimizations to clean up stale jobs that should rein in the amount of resources that the Trunk extension is using. We also have a forthcoming release of the extension that will allow configuring the extension's CPU usage.

If you have any issues upgrading to 1.11.1, let us know!

@Oni-giri
Copy link
Author

Thanks @laurit17 for the answer! I just upgraded, I'll keep you updated.

@Oni-giri
Copy link
Author

Oni-giri commented Jul 8, 2023

Hi @laurit17, new issue: Trunk is eating my memory alive!

Capture d’écran 2023-07-09 à 02 24 13
Analysis of sampling trunk (pid 7524) every 1 millisecond
Process:         trunk [7524]
Path:            /Users/USER/*/trunk
Load Address:    0x10041c000
Identifier:      trunk
Version:         ???
Code Type:       ARM64
Platform:        macOS
Parent Process:  ??? [1]

Date/Time:       2023-07-09 02:22:31.863 +0300
Launch Time:     2023-07-02 05:33:14.999 +0300
OS Version:      macOS 13.4.1 (22F82)
Report Version:  7
Analysis Tool:   /usr/bin/sample

Physical footprint:         2.8G
Physical footprint (peak):  2.8G
Idle exit:                  untracked

I can send you the full report by mail if you want.

@laurit17
Copy link
Contributor

I would really appreciate any info you are able to provide, thanks. feel free to email any info you have to lauri [at] trunk [dot] io.

I'm also curious about your usage patterns. We'd expect fairly light memory usage from the trunk binary itself, with spikes from running linters.

Curious - do you also see this only when using the vscode extension. Do you run trunk from the command line as well? DO you get a high memory footprint if you are doing that too?

@det
Copy link
Contributor

det commented Dec 26, 2023

Please check out the latest version of trunk 1.81.1, we have fixed an issue that could occasionally cause trunk to consume CPU indefinitely.

@TylerJang27
Copy link
Collaborator

Hi @Oni-giri, have you had the chance to try this out on the latest versions (1.18.1 or 1.19.0)?

@philsherry
Copy link

This is very much still an issue, btw. I have to kill groups of 4-6 trunk processes on a fairly regular basis.

Do any of the Trunk team actually use Trunk in a real-world project, with VS Code on a Mac?

cli:
  version: 1.21.0
plugins:
  sources:
    - id: trunk
      ref: v1.4.5

@det
Copy link
Contributor

det commented Apr 2, 2024

Hi @philsherry,

Sorry you are experiencing this. For context, trunk will launch a daemon for every git repository you open. This daemon process will currently stay alive forever, but the next version of trunk will have the daemon auto shutdown after some period of inactivity. Could you please provide more information about what you are seeing?

  • Are you using multiple git repositories?
  • Are these trunk processes consuming a large amount of CPU? How much? Is it constant it sporadic?
  • Would auto shutdown of daemon processes solve the problem you are seeing?

Thank you for your feedback!

@philsherry
Copy link

👋🏻 @det

Have you tested this with many projects that use git submodules? Due to the nature of my work, I might have two instances of VS Code running, each with at least one submodule. Trunk CPU usage can be anywhere from ~40% to 90% during these times.

The thing is, I might never need to lint any of the files in those submodules—is it still spun up regardless, even if I have that directory in the ignore paths?

Could there be some kind of defer option available? “Don’t start trunking on this tree until the user issues a command in a file” kinda thing? (I’m literally thinking as I’m typing, so this might be a garbage idea, or even something that you already do.)

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

No branches or pull requests

5 participants