Description
Version
v16.13.1
Platform
Darwin hhunt-mbp-m1pro 21.5.0 Darwin Kernel Version 21.5.0: Tue Apr 26 21:08:37 PDT 2022; root:xnu-8020.121.3~4/RELEASE_ARM64_T6000 arm64
Subsystem
libuv
What steps will reproduce the bug?
- I'm not sure how to reproduce it in isolation, but the
libuv
project may have notes on that as they fixed the problem: - On a closed-source project I'm working on we have ~30 developers hitting this condition every few minutes
- We either have to wait 2-5 minutes for the loop to break, or just force quite / kill -9 and start node again
How often does it reproduce? Is there a required condition?
Within my team, every few minutes.
We do not know how to reproduce this in isolation.
The libuv
ticket mentions "specific VPN software" that can exacerbate the problem and we are all using the same VPN software on Mac OS (both Intel and ARM) so that could be the key.
A major key is that the loop is stuck 100% in native code in a tight loop - As a result, Ctrl-C will not interrupt the application and it must be forced to exit.
What is the expected behavior?
No infinite loops in native code.
What do you see instead?
Infinite loops in native code (stepped through in debugger).
Additional information
This next.js
issue appears to be due to this. All the reports are from Mac OS users and the behavior described is "does not respond to Ctrl-C until a few minutes have passed" (paraphrasing), so it seems this is happening in the wild but nobody looked at this in a debug build to find that the loop was already known and fixed :)
These two fixes cherry-picked from libuv will address the issue:
libuv/libuv#3405
libuv/libuv#3413
I can prepare PRs if desired.
We're really like to have this fix for at least node16
and later versions.
Thanks!