-
fix(core): prevent hanging between command end and process exit (#33500)
发布于
2025-11-17 14:57:34 +00:00 Current Behavior
In certain scenarios, Nx commands would hang between command completion
and process exit. This was caused by inefficient message end detection
in the
daemon socket communication, where the check forMESSAGE_END_SEQcould
fail when TCP packets were fragmented.Expected Behavior
With this PR, the message end detection is more robust and handles TCP
packet fragmentation correctly, preventing the hanging issue. The
changes also
add better performance tracking and logging to help diagnose similar
issues in the future.Changes Made
-
Improved message end detection
(consume-messages-from-socket.ts): Added a preliminary check of the
last character's code point before checking
the full MESSAGE_END_SEQ, which prevents false negatives when TCP
packets are fragmented -
Enhanced performance tracking (
daemon/client/client.ts,
daemon-socket-messenger.ts): Added message-type-specific performance
marks and
measures for better debugging -
Added server-side logging (
daemon/server/server.ts): Added
logging for message receipt, serialization, and response to help
diagnose
communication issuesRelated Issue(s)
This fix addresses hanging issues observed in daemon communication when
commands complete but the process doesn't exit.下载附件
-