redhat-developer / vscode-server-connector

📦 Connects Visual Studio Code to your server adapters and run, deploy apps !!
Eclipse Public License 2.0
56 stars 26 forks source link

Wildfly ports not accessible when running vscode in WSL #584

Closed p-kager closed 3 weeks ago

p-kager commented 1 year ago

Cannot access the wildfly ports from the host when using WSL. Everything else seems to be working fine, deployment etc.

Last version of this plugin that works is 0.25.6

robstryker commented 1 year ago

So to be clear, you're suggesting this is a regression? It used to work, but doesn't anymore? And if you install the previous version, it still works?

Can you clarify what you mean when you say accessing the wildfly ports doesn't work? You mean localhost:8080 isn't showing anything anymore?

I do not have a WSL environment and have in fact never used it. Would you be willing to do some quick debugging / info gathering for me? The vscode extension only communicates with a background process called the RSP. The RSP is what launches the wildfly instance.

Are you able to launch your wildfly with extension version 0.25.6 and then get the command line used to launch by checking either the process manager or ps -ax to find out the exact command line used to launch the wildfly instance? And then could you repeat the same with the first version that doesn't work, presumably this one: https://github.com/redhat-developer/vscode-server-connector/releases/tag/v0_26_1

Often times, a change in the command line that we use to launch the server will be easily discovered, but if there's no change in the command line, it indicates some deeper issue at work.

p-kager commented 1 year ago

Sorry should have been a bit clearer. Yes a regression. 0.25.6 works fine, anything above that doesn't.

Normally I access ports 8080 and 9990 only. They are accessible from within the WSL but not from the Windows host, so localhost:8080 and localhost:9990 are not accessible. When I rollback the plugin update to 0.25.6 it works fine.

0.25.6: /usr/lib/jvm/java-11-openjdk/bin/java -Dprogram.name=rsp:wildfly-26.1.1.Final -Xms64m -Xmx512m -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=true -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dorg.jboss.boot.log.file=/root/.rsp/redhat-server-connector/runtimes/installations/wildfly-2611finalruntime/wildfly-26.1.1.Final/standalone/log/boot.log -Dlogging.configuration=file:/root/.rsp/redhat-server-connector/runtimes/installations/wildfly-2611finalruntime/wildfly-26.1.1.Final/standalone/configuration/logging.properties -Djboss.home.dir=/root/.rsp/redhat-server-connector/runtimes/installations/wildfly-2611finalruntime/wildfly-26.1.1.Final -Dorg.jboss.logmanager.nocolor=true -Djboss.bind.address.management=localhost --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED --add-modules=java.se -classpath /root/.rsp/redhat-server-connector/runtimes/installations/wildfly-2611finalruntime/wildfly-26.1.1.Final/jboss-modules.jar org.jboss.modules.Main -mp /root/.rsp/redhat-server-connector/runtimes/installations/wildfly-2611finalruntime/wildfly-26.1.1.Final/modules org.jboss.as.standalone --server-config=standalone.xml

0.26.1: /usr/lib/jvm/java-11-openjdk/bin/java -Dprogram.name=rsp:wildfly-26.1.1.Final -Xms64m -Xmx512m -Dorg.jboss.resolver.warning=true -Djava.net.preferIPv4Stack=false -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -Dorg.jboss.boot.log.file=/root/.rsp/redhat-server-connector/runtimes/installations/wildfly-2611finalruntime/wildfly-26.1.1.Final/standalone/log/boot.log -Dlogging.configuration=file:/root/.rsp/redhat-server-connector/runtimes/installations/wildfly-2611finalruntime/wildfly-26.1.1.Final/standalone/configuration/logging.properties -Djboss.home.dir=/root/.rsp/redhat-server-connector/runtimes/installations/wildfly-2611finalruntime/wildfly-26.1.1.Final -Dorg.jboss.logmanager.nocolor=true -Djboss.bind.address.management=localhost --add-exports=java.base/sun.nio.ch=ALL-UNNAMED --add-exports=jdk.unsupported/sun.misc=ALL-UNNAMED --add-exports=jdk.unsupported/sun.reflect=ALL-UNNAMED --add-modules=java.se -classpath /root/.rsp/redhat-server-connector/runtimes/installations/wildfly-2611finalruntime/wildfly-26.1.1.Final/jboss-modules.jar org.jboss.modules.Main -mp /root/.rsp/redhat-server-connector/runtimes/installations/wildfly-2611finalruntime/wildfly-26.1.1.Final/modules org.jboss.as.standalone --server-config=standalone.xml

Looking at the output, the only difference seems to be -Djava.net.preferIPv4Stack, on the older plugin it is true.

Overriding the VM args and setting -Djava.net.preferIPv4Stack to true solved the issue.

robstryker commented 1 year ago

Overriding the VM args and setting -Djava.net.preferIPv4Stack to true solved the issue.

I'm very glad to hear that a workaround exists and we successfully discovered it. I will investigate why that flag changed and whether that was an intentional change for the given server type, or whether that was made in error.

Thanks so much for your help in this issue.

robstryker commented 1 year ago

I'd mark this as a regression. Bad change in February 2023:

https://github.com/redhat-developer/rsp-server/commit/99aa3b140afa421e3098c45c2a41432c699e5a7f#diff-9f6d5aa9649f9d9cee49eecfbf6eb868749c251f7a9d09aad79cc5baba8e6bd5R53

When determining whether a host string is ipv4 or ipv6 we do some pattern matching, but it seems the only place we actually use this function is when we call it with the string localhost as the parameter. Thus, it's returning ipv6.

robstryker commented 3 weeks ago

No changes are planned here.