-
Notifications
You must be signed in to change notification settings - Fork 319
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
Unix domain path too long when using pipe as transport for macOS on Apple Silicon #1346
Comments
The tmp directory |
I recoded the code a little that generates the pipe name. function generateRandomPipeName() {
if (process.platform === 'win32') {
return `\\\\.\\pipe\\lsp-${(0, crypto_1.randomBytes)(16).toString('hex')}-sock`;
}
let randomLength = 32;
const fixedLength = 'lsp-.sock'.length;
const tmpDir = fs.realpathSync(XDG_RUNTIME_DIR ?? os.tmpdir());
const limit = safeIpcPathLengths.get(process.platform);
if (limit !== undefined) {
randomLength = Math.min(limit - tmpDir.length - fixedLength, randomLength);
}
if (randomLength < 16) {
throw new Error(`Unable to generate a random pipe name with ${randomLength} characters.`);
}
const randomSuffix = (0, crypto_1.randomBytes)(Math.floor(randomLength / 2)).toString('hex');
return path.join(tmpDir, `lsp-${randomSuffix}.sock`);
} @testforstephen could you patch the JS code in the lib folder to see if this works for you under Mac |
@dbaeumer thanks for the quick patch. I can confirm the patch works well on macOS M2 machine, which generates a new pipe path in the format of I also tried it in Windows 10 and WSL (ubuntu 20), the new pipe format works. |
I will prepare a next release so that you can try to publish something. |
related: #1351 |
I released 9.0.2-next.1 which contains the new code to compute the pipe name |
VS Code Java extension is experimenting with using pipes as the transport mechanism between the language client and the Java language server. However, the automatically generated pipe paths for macOS on Silicon (such as
/var/folders/c4/f8v01p_s2sn9_hrx6y18dlxr0000gq/T/vscode-b4e4949e2fde772119c33ebd3ad375f0e8b742abf2.sock
) are too long and exceed the OS domain socket limit. See thegenerateRandomPipeName
function in language client, it uses 21 random bytes (which is converted to 42 characters) as suffix, can we reduce the random suffix to a lower value?vscode-languageserver-node/jsonrpc/src/node/main.ts
Lines 175 to 192 in d859bb1
See the original issues on Java extension for more context information.
// @dbaeumer WDYT?
The text was updated successfully, but these errors were encountered: