Closed devhik0 closed 1 month ago
Anything ?
Can you try next@canary first, currently it's on the latest stable version but Turbopack is in active development: https://github.com/devhik0/crm-saas/blob/master/client-app/package.json#L35
1GB of memory usage is not much in general, especially if you have large dependencies like heroicons that are quite large (thousands of files)
Seeing a similar issue running on Mac. It's smoking ~5GB of CPU:
Updated from 14.1.4 -> 14.2.4
Well I tried even next 15@rc and without turbo, still my dev server takes around 1gb memory and takes near minutes to compile.
In order to help me investigate this I'll ideally need an application that can be run, if you can't provide that (I understand if you can't) please provide the .next/trace
and .next/trace.log
file.
Please follow these steps which would give me the best picture to investigate:
npm install next@canary
(use the package manager you're using) -- We want to make sure you're using the very latest version of Next.js which includes the fixes mentioned earlier.rm -rf .next
NEXT_CPU_PROF=1
and NEXT_TURBOPACK_TRACING=1
(regardless of if you're using Turbopack, it only affects when you do use Turbopack) environment variable. E.g.:
NEXT_TURBOPACK_TRACING=1 NEXT_CPU_PROF=1 npm run dev
NEXT_TURBOPACK_TRACING=1 NEXT_CPU_PROF=1 yarn dev
NEXT_TURBOPACK_TRACING=1 NEXT_CPU_PROF=1 pnpm dev
ctrl+c
).next/trace
file to https://gist.github.com -- Please don't run trace-to-tree yourself, as I use some other tools (e.g. Jaeger) that require the actual trace file..next/trace.log
as well, if it's too large for GitHub gists you can upload it to Google Drive or Dropbox and share it through that.next.config.js
(if you have one) to https://gist.github.comYou know that problematic repo, i will provide env values to run it properly. Here is the project folder and env values, just put lines into a .env.local
file inside folder root. project folder
# Supabase
NEXT_PUBLIC_SUPABASE_URL=https://jokkvunyzexyiwypinjd.supabase.co
NEXT_PUBLIC_SUPABASE_ANON_KEY=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Impva2t2dW55emV4eWl3eXBpbmpkIiwicm9sZSI6ImFub24iLCJpYXQiOjE3MTYzODIyNzEsImV4cCI6MjAzMTk1ODI3MX0.O-_1nkM2Blhm7kjscCL9bC0BIp_yhLeKGVoFKDdo_bw
cd client-app
, bun i (to use another package manager, you need to remove bun.lockb before
, bun run dev (w/o --turbo flag)
, click tabs on sidebar to check page loads, try to make changes at related files like app/calendar/page.tsx
to see HMR response times. I am seeing it like this:
○ Compiling /tasks ...
✓ Compiled in 39.9s (sometimes around 60)
✓ Compiled /tasks in 18.2s
Let me know if something goes wrong, thanks for your interest.
Can you try to run the steps to grab a trace as well so that we have numbers for your machine? Thanks!
Anything?
Hey @devhik0 sorry I couldn't get around to looking into this yet, could you create a new share link as the old one expired. Thanks!
Hey @timneutkens here is files, please download before expire :) files It didnt write trace.log file
Also if helps i have another related issue at typescript repo and we found that typescript has some issues with Generics so i was using generics at my ui library (shadcn) when i remove generics it was faster but i dont know its related. here is the link for issue typescript
Anything?
@devhik0 seems you're not using Turbopack 🤔 The trace indicates it's using webpack, is that expected?
Yes it's webpack, turbopack gives similar results like freezing. We can go with webpack @timneutkens
The Turbopack trace has much more context on memory usage, so I'd like to receive that if possible, especially in the case where you're saying it freezes 👍
@timneutkens Actually i only want a solution for current situation cuz i won't use turbopack for a long while.
Regardless please share the trace file as that allows me to investigate further.
I shared files already you can find inside of it @timneutkens
It's not the Turbopack trace, which is what I requested above. You only shared a webpack trace which we can't use to investigate memory usage.
Overall 1GB memory usage with the amount of code and modules you're compiling with webpack does not seem off / high.
I am not using turbopack at all. But i understand what is problem though, had to upgrade my hardware and problem solved for 2000$ 😂 . Thanks for your all effort
Okay I guess I'll close the issue then 👍 In the initial issue you said you were using --turbo
btw 😄
This closed issue has been automatically locked because it had no new activity for 2 weeks. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
Link to the code that reproduces this issue
https://github.com/devhik0/crm-saas
To Reproduce
next dev --turbo
and check Memory values at task manager, htop etc. Also check VS Code's process explorer viaF1 > Open Process Explorer
and look for"<path>\nodejs\node.exe" <path-to-app>\node_modules\next\dist\server\lib\start-server.js
Current vs. Expected behavior
That process above is consuming around 1GB memory at idle state (just running and no code change), thus code change reflections taking around > 30s to appear on UI. Here is the latest hmr result:
Expected: faster rebuilds to see what happens at UI in short time and less memory consumption
I think there is a memory leak at somewhere in process.
Provide environment information
Which area(s) are affected? (Select all that apply)
Developer Experience, Module Resolution, Performance, Runtime, Turbopack, TypeScript
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
Here i am sharing process info from my system to show what is happening actually:
The process with red is :
<path>\nodejs\node.exe" <path-to-app>\node_modules\next\dist\server\lib\start-server.js
Also this is from process explorer at vscode: