-
Notifications
You must be signed in to change notification settings - Fork 244
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
Big Sur hardened runtime versus fork
yields large slowdown in node-pty.spawn()
#476
Comments
fork
fork
yields large slowdown in node-pty.spawn()
I think we dont use any fork/exec specialties and should be able to transit to Things to watch out for though are:
|
We did hit this in VS Code and I think may have worked around it with a patch. It's an upstream issue in electron/libuv which should get fixed eventually so I'm not sure its worth the effort to try fix. |
@Tyriar the patch in vscode only handles the calls done to libuv for process spawn which currently is from
Agree with this, the libuv patch does the same. I will take a stab at this in July if it hasn't been covered. |
@deepak1556 Just a wild idea - does libuv-spawn expose enough primitives to use it instead of any own fork/spawn logic? I think all we need for a PTY process attach is the functionality of Not sure if there can be won anything, at least it sounds intriguing to me to delegate the low level process spawning to a well maintained lib |
Added a PoC implementation in #486 |
Environment details
Issue description
When running
node-pty.spawn()
from within a macOS "hardened runtime" context, it appears that thefork()
POSIX API is very slow [1] [2]. The referenced issues discuss the use ofposix_spawn()
versusfork()
, and I see that node-pty's pty.cc usesfork()
.This only seems to affect the combination of macOS 11 and the use of the macOS hardened runtime. You get this whenever signing node-pty.
We are seeing that each
spawn
call takes about 300ms, which is at least 100x slower than in other combinations.[1] libuv/libuv#3050
[2] electron/electron#26143
The text was updated successfully, but these errors were encountered: