fix(core): clean up stale socket files before listening#34236
fix(core): clean up stale socket files before listening#34236AgentEnder merged 1 commit intonrwl:masterfrom
Conversation
✅ Deploy Preview for nx-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
AgentEnder
left a comment
There was a problem hiding this comment.
This looks good to me, going to let @FrozenPandaz weigh in before merging
|
View your CI Pipeline Execution ↗ for commit 0b09a2c
☁️ Nx Cloud last updated this comment at |
There was a problem hiding this comment.
Important
At least one additional CI pipeline execution has run since the conclusion below was written and it may no longer be applicable.
Nx Cloud has identified a possible root cause for your failed CI:
Our analysis shows both failures are environment-related and not caused by the PR's socket cleanup implementation. The e2e-workspace-create failure is a pre-existing vitest worker IPC issue (9.89% flaky, confirmed in master branch), while the e2e-gradle failure is an external Java toolchain registry timeout. Neither correlates with the Unix socket cleanup changes in this PR.
No code changes were suggested for this issue.
You can trigger a rerun by pushing an empty commit:
git commit --allow-empty -m "chore: trigger rerun"
git push
🎓 Learn more about Self-Healing CI on nx.dev
12add2a to
f426083
Compare
👷 Deploy request for nx-dev pending review.Visit the deploys page to approve it
|
|
Pushed to resolve merge conflicts. |
Handles PID recycling in containers where a previous process with the same PID left behind a socket file, causing EADDRINUSE errors. - Added cleanupSocketFile() helper to remove stale socket files - Updated PseudoIPCServer.init() to clean up before listening - Refactored ForkedProcessTaskRunner to use createPseudoTerminal helper - Added unit tests for socket cleanup behavior Fixes nrwl#34233
f426083 to
0b09a2c
Compare
## Current Behavior When running Nx tasks in CI environments (e.g., Buildkite) where the host's /tmp is mounted to containers, intermittent EADDRINUSE errors occur in PseudoIPCServer.init(). This happens because: 1. PseudoIPCServer doesn't clean up its Unix socket file before calling listen() 2. ForkedProcessTaskRunner.createPseudoTerminal() instantiates PseudoTerminal directly instead of using the createPseudoTerminal() helper, bypassing shutdown callback registration When a new container starts with the same PID as a previous run (PID recycling), it generates the same socket path and hits EADDRINUSE because the stale socket file still exists. ## Expected Behavior No EADDRINUSE errors should occur. The PseudoIPCServer should defensively remove any stale socket file before attempting to listen, similar to how the daemon server handles this. ## Related Issue(s) Fixes #34233 (cherry picked from commit f5a7ea1)
|
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
Current Behavior
When running Nx tasks in CI environments (e.g., Buildkite) where the host's /tmp is mounted to containers, intermittent EADDRINUSE errors occur in PseudoIPCServer.init(). This happens because:
When a new container starts with the same PID as a previous run (PID recycling), it generates the same socket path and hits EADDRINUSE because the stale socket file still exists.
Expected Behavior
No EADDRINUSE errors should occur. The PseudoIPCServer should defensively remove any stale socket file before attempting to listen, similar to how the daemon server handles this.
Related Issue(s)
Fixes #34233