Comments (13)
I'm getting the same issue, I tracked it to this line: https://github.com/vercel/turborepo/blob/15a11406c196a1e3c4497601fa72b5e5a9b4154f/cli/internal/run/run.go#L344
When I comment it out, rebuild turborepo and run it on the sample, CPU usage drops to 0
I think I have an idea what's happening - RunState expects the tasks to run, then finish, but yarn dev
in examples are actually long-running tasks that watch and rebuild code, so they never finish. Apologies if I'm wrong I don't really know go and just dabbled in the code for 2 hours.
As fas I can see, RunState is responsible for rendering this:
However, I had to set runOptions.stream
to false
to actually see this output, but the default is true
and it's not actually possible to set it to false
. I'm not really sure how to fix it, the only idea I had was to disable the listener when stream is false:
func (r *RunState) Listen(Ui cli.Ui, startAt time.Time) {
if !r.runOptions.stream {
return
}
But this will essentially disable RunState and I doubt this is the desired fix. Anyway, hope this helps someone with the proper fix!
EDIT: I've actually realized that both cases rely on runOptions.stream
being false, so I can actually move the check before and remove the two underlying checks. I've whipped up a PR that might serve as either a hotfix or a springboard for a better fix: #529
from turborepo.
I'm not a go developer and am trying to stumble my way through debugging this issue.
I was looking into how to get the cpuprofile and heap traces; however looking into the code:
- I believe that
pprof.StopCPUProfile()
(see: https://github.com/vercel/turborepo/blob/main/cli/cmd/turbo/main_utils.go#L58-L61) isn't being called and as such the file not being written. - The reason it's not being called is that the deferred methods (for example: https://github.com/vercel/turborepo/blob/main/cli/cmd/turbo/main.go#L115) aren't being called on SIGINT
I am going to continue to look into how I can get this code to run on SIGINT (any help would be appreciated). Hopefully that might help to find the source of the high cpu utilisation.
from turborepo.
So a workaround is to go to the app directly and run it from there?
from turborepo.
For me it is 10% of CPU usage when idle in case I'm running dev command with turbo. Comparing it to running all packages and apps dev commands separately with just yarn then my CPU load is approaching 0% when idle.
-` vavra@archlinux
.o+` ---------------
`ooo/ OS: Arch Linux x86_64
`+oooo: Host: Zephyrus M GM501GS 1.0
`+oooooo: Kernel: 5.15.7-arch1-1
-+oooooo+: Uptime: 5 hours, 3 mins
`/:-:++oooo+: Packages: 1186 (pacman)
`/++++/+++++++: Shell: bash 5.1.12
`/++++++++++++++: Resolution: 1920x1080
`/+++ooooooooooooo/` DE: GNOME 41.2
./ooosssso++osssssso+` WM: Mutter
.oossssso-````/ossssss+` WM Theme: Adwaita
-osssssso. :ssssssso. Theme: Adwaita [GTK2/3]
:osssssss/ osssso+++. Icons: Adwaita [GTK2/3]
/ossssssss/ +ssssooo/- Terminal: gnome-terminal
`/ossssso+/:- -:/+osssso+- CPU: Intel i7-8750H (12) @ 4.100GHz
`+sso+:-` `.-/+oso: GPU: NVIDIA GeForce GTX 1070 Mobile
`++:. `-/+/ Memory: 5745MiB / 32025MiB
.` `/
from turborepo.
Also happen on Mac Air M1 :D Almost sold it for the 14 inch but then I found this issue
from turborepo.
+1 - 100% CPU usage on a single thread on Ubuntu 20.04 5950X CPU. When the apps are run separately it idles around 2% or less. Happy to help debug further.
from turborepo.
Can you run with --heap=heap
and --cpuprofile=profile
and DM me in https://turborepo.org/discord?
from turborepo.
@jaredpalmer No --heap or --cpuprofile flag, but have --profile,
./node_modules/.bin/turbo run dev --profile=prof
but prof was not written.
from turborepo.
Update: need to pass filenames to these flags. Sorry for confusion
Can you run with --heap=heap
and --cpuprofile=profile
and DM me in https://turborepo.org/discord?
from turborepo.
Can you run with
--heap=heap
and--cpuprofile=profile
and DM me in https://turborepo.org/discord?
I run it with parameters as you instructed and files appeared in root. Not sure what extension of the files should be but they are empty anyway since both have 0 bytes.
from turborepo.
Seeing the same cpu load issue (using npm). Also getting an empty file when running with the --heap=heap
and --cpuprofile=profile
flags.
MacBook Pro (16-inch, 2019)
2.4 GHz 8-Core Intel Core i9
64GB 2667 MHz DDR4
from turborepo.
Can replicate on windows too, one core is pegged at 100%.
After creating the repo via npx create-turbo@latest
and running
yarn dev --scope=*docs* --heap=heap --cpuprofile=profile
I can confirm that it generates 0 sized files for heap
and profile
but I believe that's to be expected as I'm running it under watch mode, and it will never have time to write heap
& profile
to disk when closing the program.
Maybe this will help:
- closing the program exits with code 1
- it sometimes leaves orphan processes hanging around, occupying either port 3000 or 3001
from turborepo.
If you need an open-source example, this happens in the Astro repo: https://github.com/withastro/astro
If you run:
yarn
yarn dev
And wait, you'll see Turbo at 100% CPU.
from turborepo.
Related Issues (20)
- Wrong env var prefix for SvelteKit framework inference
- expo debugger not working if server start from root(only windows OS) HOT 11
- Add `__NIX_DARWIN_SET_ENVIRONMENT_DONE` to default pass through envs (`globalPassThroughEnv`) HOT 8
- Docs: document `turbo.*` generator variables HOT 2
- Turbo gen hangs when used with `--root`
- Issue with Path Aliases and ESLint in Turborepo with TypeScript HOT 3
- add a new example typescript with rust HOT 3
- Error message on package.json : specify which repo workspace HOT 2
- warning: the following paths have collided (e.g. case-sensitive paths on a case-insensitive filesystem) and only one from the same colliding group is in the working tree
- Deployment of `examples/with-svelte` on Vercel fails HOT 3
- Dry run doesn't output tasks that changed for modified root workspace inputs HOT 6
- Filewatcher ignore from `.gitignore` not working HOT 2
- custom remote cache WARNING failed to contact remote cache: Error making HTTP request: HTTP status client error (413 Payload Too Large) for url (...) HOT 2
- Docs: Vitest docs are both incorrect and incomplete HOT 1
- Getting `ERR_UNSUPPORTED_ESM_URL_SCHEME` error when trying to build with turbo repo on Windows (GH actions) HOT 3
- File watching fails due to file not found on Ubuntu 22.04 LTS
- Extremely slow with 100% CPU usage HOT 4
- TMP and TEMP env variables are not passed through HOT 1
- Docs: mention `--graph` when talking about the task graph HOT 1
- Docs: Improve UX - Prevent empty folders from opening and closing
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from turborepo.