-
-
Notifications
You must be signed in to change notification settings - Fork 532
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
Endlessly spawning loaders in node 20.0.0 leading to large memory leak #1995
Comments
I checked some more, I am basically certain the cause is from |
You're probably running into nodejs/node#47566, |
Removing Regardless of the other issue, having this behaviour happen with Curiously the successive loaders with Unless |
Seems the reproduction was broken, I've updated it. |
I have this issue as well. If I change my script from
So maybe running The same script works fine on |
We had a similar issue. The problem was caused by importing a In our case, we were importing |
This issue has already been fixed in Node 20.1.0. |
Yes this can be closed now. |
Search Terms
Node 20.0.0
Problem
As of Node 20.0.0 using the
ts-node/esm
loader has a problem where the loader is endlessly loaded over and over, for example if we run the following program:Running it with the esm loader:
we get:
These warnings will continue ad-infinitum until within a few seconds the Node process consumes all of the system memory and is eventually killed by the OS.
Now I'm not entirely sure if this problem is something ts-node can fix, or if something is broken in Node's loader implementation. I did create a little toy loader to see if Node was unconditionally broken and it didn't seem to be.
I haven't really even been able to debug this as
--inspect-brk
doesn't stop loader code so the memory exhaustion just happens within a few seconds so opening devtools and the like doesn't help.My speculation here is that
ts-node
ortypescript
itself is forking a child process which winds up with the same loader.This speculation is based on the fact that a simple dummy loader that forks a child process exhibits similar behaviour:
Specifications
Linux 5.19.0-38-generic #39~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Fri Mar 17 21:16:15 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
The text was updated successfully, but these errors were encountered: