-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
pseudo IPC socket is not deleted resulting in Error: listen EADDRINUSE: address already in use /tmp/xxx/fpxxx.sock #21610
Comments
A workaround is to run Something to investigate is if you are getting an error when you stop the docker image. I'm getting |
I can confirm this issue on Linux. It started occurring when we migrated to NX v18. On v17.0.3 we don't run into this issue. |
We're encountering this issue in a containerised CI environment, after updating |
Same here, but with Nx 18.0.5 |
same |
The fix that @Markus-Ende suggested worked for me. I used yarn to patch |
Had the same issue on Windows with Nx 18.0.8 |
+1, Nx 18.0.8, While deploying and running in Docker on Fly.io |
+1, Same issue on Mac with Nx 18.0.8 |
While waiting for the fix, please use NPM library Patch Package with the following Git patch: diff --git a/node_modules/nx/src/tasks-runner/psuedo-ipc.js b/node_modules/nx/src/tasks-runner/psuedo-ipc.js
index c2a631a..f8f90f0 100644
--- a/node_modules/nx/src/tasks-runner/psuedo-ipc.js
+++ b/node_modules/nx/src/tasks-runner/psuedo-ipc.js
@@ -17,6 +17,7 @@
* * channel = getPsuedoIpcChannel(process.env.NX_IPC_CHANNEL_ID)
* * forkChildProcess.on('message', writeToPsuedoIpcChannel)
*/
+const fs = require("fs");
Object.defineProperty(exports, "__esModule", { value: true });
exports.PsuedoIPCClient = exports.PsuedoIPCServer = void 0;
const net_1 = require("net");
@@ -29,6 +30,7 @@ class PsuedoIPCServer {
this.childReadyMap = new Map();
}
init() {
+ fs.existsSync(this.path) && fs.unlinkSync(this.path); // remove fpXX.sock file if existing
return new Promise((res) => {
this.server = new net_1.Server((socket) => {
this.sockets.add(socket); |
Note: file was renamed: https://github.com/nrwl/nx/blob/master/packages/nx/src/tasks-runner/pseudo-ipc.ts |
Another possible fix, without patching NX, while this issue is open:
See |
There are multiple issues here, and one seems to be with the path length. I fixed the issue by setting I see @AgentEnder is assigned to this, maybe a try-catch to try a shorter socket dir would sorta work? We also tried mounting a container with Created #26936 to address the path length part of the issue. |
This issue has been automatically marked as stale because it hasn't had any activity for 6 months. |
Current Behavior
We run our local dev environment using docker compose. While doing so, we get this error message after restarting:
Error: listen EADDRINUSE: address already in use /tmp/somefolder/fpXX.sock
(XX depending on process id).After some debugging I found out, that the .sock file is not properly deleted between runs.
As a workaround, this issue can be fixed by adding this line to the top of psuedo-ipc.js#init() (https://github.com/nrwl/nx/blob/master/packages/nx/src/tasks-runner/psuedo-ipc.ts#L42):
The problem doesn't occur when not using docker compose, probably, because there the PID is changed more frequently. Or maybe an appropriate close hook is not called properly.
Expected Behavior
I should be able to re-start docker compose environment / fpXX.sock files should be properly cleaned.
GitHub Repo
No response
Steps to Reproduce
nx serve
taskIf you really need a repo to reproduce, I can provide one, but it is currently not straight-forward for me to create a workspace due to this issue: #20270
Nx Report
Failure Logs
Package Manager Version
npm@10.2.4
Operating System
Additional Information
tried on macOS and WSL2
The text was updated successfully, but these errors were encountered: