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

v1.15.x causes Java to be non-functional in GitHub Codespaces #2968

Closed
mor10 opened this issue Feb 27, 2023 · 9 comments · Fixed by #2978
Closed

v1.15.x causes Java to be non-functional in GitHub Codespaces #2968

mor10 opened this issue Feb 27, 2023 · 9 comments · Fixed by #2978
Assignees

Comments

@mor10
Copy link

mor10 commented Feb 27, 2023

Running and debugging Java projects stopped working in Codespaces with the release of v1.15.00. Clicking the Run button on a project while in the web-based Codespaces results in the panel below appearing and hanging in an endless loop. The project never runs.
Screenshot 2023-02-27 at 10 59 04 AM

Downgrading to v1.14.0 solves the problem. Upgrading to the pre-release does not resolve the problem.

Related issue: microsoft/vscode-java-debug#1148

Environment
  • Operating System: GitHub Codespaces
  • JDK version: ??
  • Visual Studio Code version: latest
  • Java extension version: 1.15.0
Steps To Reproduce
  1. Start a codespace from https://github.com/LinkedInLearning/practice-it-java-3086189
  2. Go to folder _01_02e and open Employee.java.
  3. Click the play button in the upper right corner to run Java.
Current Result

The above modal appears in the bottom right-hand corner and loops endlessly. Nothing else happens.

Expected Result

Java runs and output is produced in the terminal.

@jdneo
Copy link
Collaborator

jdneo commented Feb 28, 2023

无标题
I cannot reproduce the issue. Have you tried to clean the workspace cache? Is there any errors in the logs?

See: https://github.com/redhat-developer/vscode-java/wiki/Troubleshooting

@mor10
Copy link
Author

mor10 commented Feb 28, 2023

@jdneo I think you might be the odd one out here. I just tested on a recently factory reset Chromebook with no previous cache of any kind and the same issue persists. @davidgassner is reporting the same issue. So is @jkeech.

Following the troubleshooting steps in the wiki does not solve the issue for me. The only ting that solves it is rolling back the version to 1.14.0

A potential path forward is to figure out why you are not seeing the issue when we are.

@davidgassner
Copy link

davidgassner commented Feb 28, 2023

@jdneo As @mor10 indicated, I'm seeing this issue too. Here are added elements:
-If I open the codespace in desktop VS Code it works fine.
-Downgrading the extension to 1.14.0 fixes the issue.
-After downgrading and running at least once, I can upgrade back to the release version and it works.

@jdneo
Copy link
Collaborator

jdneo commented Mar 1, 2023

I checked it again today still cannot repro it in the codespace, have no idea why.

@snjeza @rgrunber @fbricon Will you repro it in your codespace?

@snjeza
Copy link
Contributor

snjeza commented Mar 1, 2023

@jdneo I can't reproduce the issue.
@mor10 @davidgassner Could yo try to set

"java.server.launchMode": "Standard"

@mor10
Copy link
Author

mor10 commented Mar 1, 2023

@snjeza That seems to solve the issue for the example project! Looking closely I can see I'm testing across other projects to see if this is the project was using "LightWeight" mode when it was not working and this setting changes that.

Will report back and close the issue once I've done more extensive testing, but so far this looks good! Thanks.

@rgrunber
Copy link
Member

rgrunber commented Mar 2, 2023

I'm able to reproduce it in Codespaces.

On 1.14.0 & 1.15.0, the vscode-java extension is in lightweight mode but the settings clearly show ("java.server.launchMode":"Hybrid"). The odd part is I'm pretty sure the first time I attempted this, downgrading to 1.14.0 worked. However, I can confirm looking through the processes that only the syntax server is up, and the standard one never launched.

image

You can choose to load the projects, or set the launch mode to "Standard" and the problem should go away. However, if you don't do the workaround, and click the Run/Debug button, there should be a prompt to inform you that running/debugging requires standard mode, and offer you to switch. In Codespaces, the prompt never shows, and instead you just see the "Importing Projects" mentioned by others.

Overall, I see 2 issues worth investigating :

1. Why is "java.server.launchMode":"Hybrid" not being respected ?
2. The progress bar basically shows up, but it isn't doing anything, and since the prompt to switch to standard mode never shows, it seems like something is going wrong around https://github.com/microsoft/vscode-java-debug/blob/0.49.0/src/utility.ts#L232-L235 . Could it be #2905 ? But then why can't it be reproduced locally?

I also noticed the language servers don't seem to shut down between reloading the window, so they all remain. Even stranger, attempting to terminate them with kill spawns replacements. But that should only happen if they're all still connected to the client(s) 🤯 .

Also, I started seeing the extension host just fail if I reloaded the window enough times :

stacktrace
2023-03-01 20:47:04.082 [error] [remote-connection][ExtensionHost][0844b…][reconnect][codespaces+rgrunber-didactic-guacamole-5g79pxgr49379px:443] received error control message when negotiating connection. Error:
2023-03-01 20:47:04.087 [error] $@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:638:59889
p/<@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:638:50515
invoke@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:145
deliver@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:2066
fire@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:1704
fire@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:550:14743
E@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:550:18843
beginAcceptReconnection/<@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:550:17988
invoke@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:145
deliver@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:2066
fire@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:1704
acceptChunk@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:550:12474
f/<@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:550:11761
onData/<@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:638:38972
invoke@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:145
deliver@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:2066
fire@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:1704
22988/r</initializeChannel/r</</</<@https://github.dev/static/app.83f9ccac42f1a27d29ec.js:1:151770
invoke@https://github.dev/static/220.071cbdd47a32aa14db31.js:1:26065
fire@https://github.dev/static/220.071cbdd47a32aa14db31.js:1:26795
handleDataReceived@https://github.dev/static/commons-app-sshChannel.js.c28c5b6a7bea32de198a.js:1:5079
handleDataMessage@https://github.dev/static/commons-app-connectionService.js.55328785f9c746a9eb83.js:1:7458
handleMessage@https://github.dev/static/commons-app-connectionService.js.55328785f9c746a9eb83.js:1:2619
handleMessage@https://github.dev/static/commons-app-sshSession.js.f6ea02ef21f506892001.js:1:7508
processMessages@https://github.dev/static/commons-app-sshSession.js.f6ea02ef21f506892001.js:1:5879

2023-03-01 20:47:04.090 [error] [remote-connection][ExtensionHost][0844b…][reconnect] A permanent error occurred in the reconnecting loop! Will give up now! Error:
2023-03-01 20:47:04.093 [error] $@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:638:59889
p/<@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:638:50515
invoke@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:145
deliver@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:2066
fire@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:1704
fire@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:550:14743
E@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:550:18843
beginAcceptReconnection/<@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:550:17988
invoke@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:145
deliver@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:2066
fire@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:1704
acceptChunk@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:550:12474
f/<@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:550:11761
onData/<@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:638:38972
invoke@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:145
deliver@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:2066
fire@https://main.vscode-cdn.net/stable/92da9481c0904c6adfe372c12da3b7748d74bdcb/out/vs/workbench/workbench.web.main.js:83:1704
22988/r</initializeChannel/r</</</<@https://github.dev/static/app.83f9ccac42f1a27d29ec.js:1:151770
invoke@https://github.dev/static/220.071cbdd47a32aa14db31.js:1:26065
fire@https://github.dev/static/220.071cbdd47a32aa14db31.js:1:26795
handleDataReceived@https://github.dev/static/commons-app-sshChannel.js.c28c5b6a7bea32de198a.js:1:5079
handleDataMessage@https://github.dev/static/commons-app-connectionService.js.55328785f9c746a9eb83.js:1:7458
handleMessage@https://github.dev/static/commons-app-connectionService.js.55328785f9c746a9eb83.js:1:2619
handleMessage@https://github.dev/static/commons-app-sshSession.js.f6ea02ef21f506892001.js:1:7508
processMessages@https://github.dev/static/commons-app-sshSession.js.f6ea02ef21f506892001.js:1:5879

2023-03-01 20:47:04.096 [error] Extension host (Remote) terminated unexpectedly with code null.
2023-03-01 20:47:04.100 [error] Extension host (Remote) terminated unexpectedly. The following extensions were running: vscode.git-base, GitHub.codespaces, vscode.emmet, redhat.java, VisualStudioExptTeam.vscodeintellicode, vscjava.vscode-java-debug, vscjava.vscode-java-dependency, vscjava.vscode-java-pack, vscode.github-authentication, vscode.git, vscode.github, vscjava.vscode-java-test, vscode.microsoft-authentication, vscode.debug-auto-launch, vscode.merge-conflict, dbaeumer.vscode-eslint, GitHub.vscode-pull-request-github

@Eskibear
Copy link
Contributor

Eskibear commented Mar 2, 2023

Why is "java.server.launchMode":"Hybrid" not being respected ?

It was by design to speed up first time startup in CodeSpaces, where most users are supposed to view code or do minor modification, and switch to standard mode on demand. See #1780

@rgrunber
Copy link
Member

rgrunber commented Mar 2, 2023

Ok, then we can ignore that behaviour. I tried reproducing the conditions with something like

diff --git a/src/extension.ts b/src/extension.ts
index 5c950e7..cd99aa6 100644
--- a/src/extension.ts
+++ b/src/extension.ts
@@ -371,7 +371,7 @@ export function activate(context: ExtensionContext): Promise<ExtensionAPI> {
                                const importOnStartupSection: string = "project.importOnFirstTimeStartup";
                                const importOnStartup = config.get(importOnStartupSection);
                                if (importOnStartup === "disabled" ||
-                                       env.uiKind === UIKind.Web && env.appName.includes("Visual Studio Code")) {
+                                       true) {
                                        syntaxClient.resolveApi(resolve);
                                        requireStandardServer = false;
                                } else if (importOnStartup === "interactive" && await workspaceContainsBuildFiles()) {

as that's probably what gets triggered in code spaces. If I also build vscode-java-debug into the same workspace and run, it seems like the prompt works on 1.14.0 and doesn't come up on 1.15.0. The difference is at https://github.com/microsoft/vscode-java-debug/blob/0.49.0/src/utility.ts#L232-L235 . api.serverMode is LightWeight on 1.14.0 and Hybrid on 1.15.0. Definitely looks to me like #2905 may be causing it.

datho7561 added a commit to datho7561/vscode-java that referenced this issue Mar 2, 2023
The API wouldn't report lightweight mode correctly when it was forced to
start in lightweight due to vscode-java detecting it was being run in
Codespaces.
This broke the mechanism to switch to standard mode in Codespaces.

Fixes redhat-developer#2968

Signed-off-by: David Thompson <davthomp@redhat.com>
@rgrunber rgrunber added this to the Mid March 2023 milestone Mar 2, 2023
@datho7561 datho7561 added the bug label Mar 2, 2023
@datho7561 datho7561 self-assigned this Mar 2, 2023
datho7561 added a commit that referenced this issue Mar 2, 2023
The API wouldn't report lightweight mode correctly when it was forced to
start in lightweight due to vscode-java detecting it was being run in
Codespaces.
This broke the mechanism to switch to standard mode in Codespaces.

Fixes #2968

Signed-off-by: David Thompson <davthomp@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

7 participants