Skip to content
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

Language Support Fails to Start on MacOS: Error: Unable to generate a random pipe name with 7 characters. #3649

Closed
bpeCRtMU opened this issue May 11, 2024 · 4 comments · Fixed by #3652
Assignees
Labels
Milestone

Comments

@bpeCRtMU
Copy link

Upon closing and reopening VS Code the Java Language Server fails to start due to the following error:

[Error - 8:04:23 AM] Language Support for Java client: couldn't create connection to server.
Error: Unable to generate a random pipe name with 7 characters.
	at t.generateRandomPipeName (/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1136512)
	at /Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1332887
	at async c.createConnection (/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1165774)
	at async c.start (/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1156291)

Quitting and restarting VS Code does not solve this issue. However, restarting the computer and reopening VS Code works. Meaning the extension works again until you close the window.

Environment
  • Operating System: MacOS Sonoma 14.4.1 or Darwin arm64 23.4.0
  • JDK version: jdk-21, project jdk: 17
  • Visual Studio Code version: 1.89.1
  • Java extension version: 1.30.0
Steps To Reproduce
  1. Open a Java Maven project in VS Code. The language server should start as normal.
  2. Close the VS Code window (don't quit).
  3. Reopen the Java Maven project in VS Code. The language server will fail to start.
Logs

The Java Extension did not produce a log file as it could not start.

VS Code:

Language Support for Java (Syntax Server) client: couldn't create connection to server.

Language Support for Java client: couldn't create connection to server.

[redhat.java]Unable to generate a random pipe name with 7 characters.
$onExtensionRuntimeError @ mainThreadExtensionService.ts:81

Error: Unable to generate a random pipe name with 7 characters.
	at t.generateRandomPipeName (vscode-file://vscode-app/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1136512)
	at vscode-file://vscode-app/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1332887
	at async c.createConnection (vscode-file://vscode-app/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1165774)
	at async c.start (vscode-file://vscode-app/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1156291)

[Extension Host] rejected promise not handled within 1 second: Error: Unable to generate a random pipe name with 7 characters.


[Extension Host] stack trace: Error: Unable to generate a random pipe name with 7 characters.
	at t.generateRandomPipeName (/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1136512)
	at /Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1332887
	at async c.createConnection (/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1165774)
	at async c.start (/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1156291)

[redhat.java]Unable to generate a random pipe name with 7 characters.

mainThreadExtensionService.ts:82 Error: Unable to generate a random pipe name with 7 characters.
	at t.generateRandomPipeName (vscode-file://vscode-app/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1136512)
	at vscode-file://vscode-app/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1332887
	at async c.createConnection (vscode-file://vscode-app/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1165774)
	at async c.start (vscode-file://vscode-app/Users/user/.vscode/extensions/redhat.java-1.30.0-darwin-arm64/dist/extension.js:2:1156291)

[Extension Host] rejected promise not handled within 1 second: Error: ENOENT: no such file or directory, open '/Users/user/Library/Application Support/Code/User/workspaceStorage/6c885cc2ecb35f2626fe6d8ad25fd086/redhat.java/jdt_ws/.metadata/.log'

@rgrunber
Copy link
Member

rgrunber commented May 13, 2024

https://github.com/microsoft/vscode-languageserver-node/blob/4fbd145c7a670b1a59fad6f50e3143e4aff92e7f/jsonrpc/src/node/main.ts#L181-L189

Do you have XDG_RUNTIME_DIR defined ? Looks like it might be too long (>70 chars) on MacOS.

@aogilvie-indeed
Copy link

I'm getting the same error message.

How can we check for this var? I have not changed my environment in the last few days (although VS Code was updated).

@fbricon
Copy link
Collaborator

fbricon commented May 14, 2024

Until this is fixed, try setting "java.transport" : "stdio" in your vscode settings. See #3634 (comment) for more details

@rgrunber
Copy link
Member

rgrunber commented May 14, 2024

Fred brought up a good point (in discussions), which is that we should be able to restart the language server with stdio if it fails the first time with pipe. The failure happens at

}, reason => {
if (isFirstTimeStart) {
this.fireFailureTraceEvent("initialize", startAt, reason);
}
throw reason;
, which is actually well before the initializationFailedHandler gets registered. This complicates relaunching.

Maybe we can improve this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

4 participants