-
-
Notifications
You must be signed in to change notification settings - Fork 160
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
Inside a docker container, tsx is no longer working after the container restarted #457
Comments
I think it can be resolved by removing the |
IPC server is for the tsx Parent (e.g. watcher) and Child (actual Node.js process) to communicate things like exit signals or watch dependencies. Is the process exiting abruptly? Sounds like it's not getting cleaned up: Line 64 in 985bbb8
I think it should be fine for the Node process to re-use the existing pipe file though because there can only be one process using the same ID at a time. Do you mind adding Docker via GitHub actions to your repo: https://github.com/louislam/tsx-issue-reproduce ? I don't have a Docker env to test it in. |
Just added the github actions. You can check the log here: |
We are also experiencing this issue of the pipe file not being cleaned up by tsx when the container shuts down. |
@privatenumber This is not always true. In our case we have multiple projects running with tsx inside docker containers and we have to mount the Maybe a random name (uuid?) could be used as the pipe name and in the unlikely scenario of it aready existing a new one could be generated? |
Gotcha. I appreciate all the context and use-cases where the socket path could collide. We could randomize the socket path but the tricky part is communicating what the random pipe path is from the parent to the child. Will think about this some more, but I welcome any ideas or PRs! |
Curious if you can find a way to uniquely identify the Containers from within Node.js? Wondering if values in Would you mind sharing the output of |
@privatenumber This seems promising, os.hostname() gives back the docker container-id! I also saw that this hostname can be overwritten with a launch arg when starting the container, so theoretically someone could give the same hostname for different containers, but that seems like a stretch :D |
npx systeminforamations (truncated) output:
|
Yeah I agree anything that can be user configured will not be a UUID. The |
system.uuid is sadly the same in both my docker containers :/ |
That's too bad :( Anyway, I don't have a reproduction of this problem to debug, and I'm not sure if this back-and-forth of asking for more info is productive. I'm going to leave it to you to open a PR with a suggested solution. |
Oh, I missed the point where multiple containers could use the same volume. In my opinion, other applications did not handle it either, I saw a lot of applications put their pipe file at If you point Also for reference, |
Its also possible that sharing /tmp with multiple containers is not a best practice. I could share a subdir of /tmp only and so a solution for the original problem would be enough. |
I think just solving this issue would be sufficient. Typically, people don't mount this file directory outside using Docker's mounting mechanism, and this directory shouldn't be mounted externally. |
Docker environments have the "HOSTNAME" env which is unique per container.
|
Getting the same problem here running multiple docker containers in an IOT environment. Is there a workaround while we search for a more permanent fix? |
@shennan Delete Reference: |
Delete the container and rerun the run command but with :nightly not :1. |
Thanks; deleting everything ( I'll keep an eye on the progress here and update the package when something has been merged in. |
🎉 This issue has been resolved in v4.7.1 If you appreciate this project, please consider supporting this project by sponsoring ❤️ 🙏 |
Acknowledgements
Minimal reproduction URL
https://github.com/louislam/tsx-issue-reproduce
Version
Tested 4.7.0 and 4.6.2
Node.js version
Tested 20.11.0 and 18.19.0
Package manager
npm
Operating system
Linux
Problem & Expected behavior
Original issue from my project: louislam/dockge#353. My application Dockge is unable to start after the server was restarted for some users.
Reproduce steps
docker compose build
docker compose up
Forever Loop
docker compose up
againError: listen EADDRINUSE: address already in use /tmp/tsx-0/26.pipe
will be shown and exited with code 1docker compose up
several time, it should be very high chance to hit the error.My observation
/tmp/
is persistent inside a docker container, all files here will remain after the container restarted/tmp/tsx-0/26.pipe
is not removed after the container is stoppedCaused by
tsx/src/utils/ipc/server.ts
Line 40 in 985bbb8
Which I believe it should belong to #413
Error Log
Contributions
The text was updated successfully, but these errors were encountered: