You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes when running Laf containers, there would be several zombie processes on the system.
And when checking inside the container, we could see that these zombie processes indeed come from Laf:
$ ps aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
node 1 0.2 0.1 1367068 108608 ? Ssl May11 8:13 node --max_old_space_size=204 --max-http-header-size=1048576 --experimental-vm-modules --experimental-fetch ./dist/index.js
node 45 0.0 0.0 0 0 ? Z May11 0:00 [sh] <defunct>
node 73 0.0 0.0 0 0 ? Z May11 0:00 [sh] <defunct>
The whole logic is run inside a background grandchild process of node, which is not directly handled by node.
As a result, the process reaping job (wait) needs to be manually done inside the shell, according to the documentation:
If a command is terminated by the control operator ampersand (&), the shell executes the command asynchronously -- that is, the shell does not wait for the command to finish before executing the next command.
The above code does not handle process reaping inside the shell, hence the zombie processes linger.
How to reproduce
Run a Laf container
Get a shell of the container with kubectl exec, docker exec, etc
Run ps aux and observe
Are you willing to submit PR?
Yes I am willing to submit a PR!
The text was updated successfully, but these errors were encountered:
Search before asking
Environment
https://laf.dev
What happened
Sometimes when running Laf containers, there would be several zombie processes on the system.
And when checking inside the container, we could see that these zombie processes indeed come from Laf:
After debugging, I suspect that the problem was caused by the following piece of code:
https://github.com/labring/laf/blob/f0c7a5864a42ed9d7cdcfcf50053832becf321f4/runtimes/nodejs/src/support/module-hot-reload.ts#L94C1-L99C30.
The whole logic is run inside a background grandchild process of
node
, which is not directly handled bynode
.As a result, the process reaping job (wait) needs to be manually done inside the shell, according to the documentation:
The above code does not handle process reaping inside the shell, hence the zombie processes linger.
How to reproduce
kubectl exec
,docker exec
, etcps aux
and observeAre you willing to submit PR?
The text was updated successfully, but these errors were encountered: