-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
net: socket file names are being truncated, and may become unremovable #13670
Comments
Just tested on Linux and this does not appear to be an issue there. |
@addaleax @bnoordhuis is this to do with the 100 char socket length limit? Refs: #12708 (comment)
Followon question, is this documented anywhere in node/libuv? I'd like to have something to refer people to if it comes up again. |
If it's an issue that we have no choice but to accept, it would be good to throw an exception instead of truncating the path. |
That is likely - although I seem to be able to create socket paths which are longer than 100 chars (maybe it doesn't include separators?). The main issue is that the path is created, but potentially outside of the visible file system - so it can't be removed. So it would be a bit strange if underlying OS subsystems just decided to silently truncate in the case where there are limits... |
Ah, according to documentation the limit would be 104 chars on mac. https://developer.apple.com/legacy/library/documentation/Darwin/Reference/ManPages/man4/unix.4.html According to this SO, Linux has a limit too (108 chars): https://unix.stackexchange.com/a/367012 I just took the example I have posted above, and increased the path length, and indeed, Linux is affected as well. Updating the issue summary. |
Fwiw, libuv v2 will fail with an error instead, but I’m not sure when that’s going to be released/included in Node. |
See nodejs/node#13670 for more details.
Got this error it in production on linux. Socket path gets truncated to 107 chars, socket does not remove on restart, program crashes on startup with EADDRINUSE. |
@addaleax Do you think we can do anything here? Document it for now perhaps? |
It's documented in the synopsis of the net module:
Looks like there's nothing else to do so I'll close this out. |
If libuv 2 won’t be happening in time for Node 11, we could decide to throw an error in Node.js instead, I guess. |
I don't know if I'm in favor but I'm not opposed either. |
Throwing an error would be the safest behavior in my opinion. I doubt everyone's first reflex will be to open the doc if they run in this issue, so a descriptive runtime would most likely help. |
Ref: https://gist.github.com/stelcheck/78c35a0a691de1e25a3a413519cc3fcb
When using a string that's about over 100 characters length, the file name being created will be truncated until it no longer shows up when doing a simple
ls
- which also means it may no longer be removable by hand.This does not happen when using relative paths, only when using long absolute paths (I haven't tested the case when using long relative paths, e.g. '../hello/../hello/../etc...').
The text was updated successfully, but these errors were encountered: