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

Unable to debug javascript file #1362

Closed
wesleybl opened this issue Oct 10, 2023 · 16 comments
Closed

Unable to debug javascript file #1362

wesleybl opened this issue Oct 10, 2023 · 16 comments

Comments

@wesleybl
Copy link

After PR #1174, I can no longer debug js files. I installed the latest snapshot and I'm not able to debug js files with this new debug. I created a simple js file, right clicked on the file and selected Debug As -> Node Program. Then I get an error window with the message:

An internal error occurred during: "Launching New_configuration".
java.net.ConnectException: Connection refused

The console prints the message:

Debug server listening at 127.0.0.1:46831

The message appears in the log:

!ENTRY org.eclipse.core.jobs 4 2 2023-10-10 15:59:04.612
!MESSAGE An internal error occurred during: "Launching New_configuration".
!STACK 0
java.lang.RuntimeException: java.net.ConnectException: Connection refused
	at org.eclipse.lsp4e.debug.debugmodel.TransportStreams$SocketTransportStreams.<init>(TransportStreams.java:59)
	at org.eclipse.lsp4e.debug.launcher.DSPLaunchDelegate.lambda$5(DSPLaunchDelegate.java:363)
	at org.eclipse.lsp4e.debug.debugmodel.DSPDebugTarget.<init>(DSPDebugTarget.java:164)
	at org.eclipse.lsp4e.debug.launcher.DSPLaunchDelegate.createDebugTarget(DSPLaunchDelegate.java:388)
	at org.eclipse.lsp4e.debug.launcher.DSPLaunchDelegate.launch(DSPLaunchDelegate.java:370)
	at org.eclipse.wildwebdeveloper.debug.node.VSCodeJSDebugDelegate.launch(VSCodeJSDebugDelegate.java:201)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:805)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:716)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1038)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$1.run(DebugUIPlugin.java:1241)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.net.ConnectException: Connection refused
	at java.base/sun.nio.ch.Net.connect0(Native Method)
	at java.base/sun.nio.ch.Net.connect(Net.java:579)
	at java.base/sun.nio.ch.Net.connect(Net.java:568)
	at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:593)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
	at java.base/java.net.Socket.connect(Socket.java:633)
	at java.base/java.net.Socket.connect(Socket.java:583)
	at java.base/java.net.Socket.<init>(Socket.java:507)
	at java.base/java.net.Socket.<init>(Socket.java:287)
	at org.eclipse.lsp4e.debug.debugmodel.TransportStreams$SocketTransportStreams.<init>(TransportStreams.java:55)
	... 10 more
@mickaelistria
Copy link
Contributor

This works on CI.
Which OS are you using? Could there be some firewall or whatever preventing the connection here?

@wesleybl
Copy link
Author

I use Ubuntu 22.04. I disabled the firewall:

$ sudo ufw disable
Firewall parado e desativado na inicialização do sistema

and I tested again but I had the same problem. With the old debug it worked, even with the firewall activated. Does the old debug use these large ports?

@wesleybl
Copy link
Author

@mickaelistria Can I specify the port?

@mickaelistria
Copy link
Contributor

There is no option to specify the port, but if you're willing to debug Wild Web Developer, you can set a specific port in the code.

@wesleybl
Copy link
Author

@mickaelistria I'm going to up any server here on this port and check if I can access it.

@wesleybl
Copy link
Author

@mickaelistria I started a python server on the port and was able to access it. So it's not a network block:

$ python3 -m http.server 46831 --bind 127.0.0.1
Serving HTTP on 127.0.0.1 port 46831 (http://127.0.0.1:46831/) ...
127.0.0.1 - - [11/Oct/2023 11:50:40] "GET / HTTP/1.1" 200 -

@mickaelistria
Copy link
Contributor

The first step of the debugger is to run node org.eclipse.wildwebdeveloper/js-debug/src/dapDebugAdapter.js. Can you please check this is working and then that you can connect to the given socket?
Another possibility is maybe the dns. Does localhost resolve to 127.0.0.1 in your case? Is IPv6 disabled? Locally, the debug adapter tells me Debug server listening at ::1:34107 with a different IP. Maybe it matters?

@wesleybl
Copy link
Author

The first step of the debugger is to run node org.eclipse.wildwebdeveloper/js-debug/src/dapDebugAdapter.js

Is this node the node of my system? I don't have a global node. I add the node path to the PATH in my .bashrc. I created a PATH environment variable in the Environment tab of the debug configuration but it still didn't work. It is node 20. Does that make a difference?

Can you please check this is working and then that you can connect to the given socket?

I didn't find the dapDebugAdapter.js file in the Eclipse folder. Is it probably in some jar? I can connect via telnet to the port specified in the Eclipse console:

$ telnet localhost 45925
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.

Does localhost resolve to 127.0.0.1 in your case?

As you can see in the command above, localhost resolve to 127.0.0.1

Is IPv6 disabled?

No:

$ sysctl -a 2>/dev/null | grep disable_ipv6
net.ipv6.conf.all.disable_ipv6 = 0
net.ipv6.conf.br-1220c36c27cf.disable_ipv6 = 0
net.ipv6.conf.br-20ea7be5aa02.disable_ipv6 = 0
net.ipv6.conf.br-4bee1f8aecdc.disable_ipv6 = 0
net.ipv6.conf.br-74c46767208b.disable_ipv6 = 0
net.ipv6.conf.br-fb09a3f9841f.disable_ipv6 = 0
net.ipv6.conf.default.disable_ipv6 = 0
net.ipv6.conf.docker0.disable_ipv6 = 0
net.ipv6.conf.eno2.disable_ipv6 = 0
net.ipv6.conf.lo.disable_ipv6 = 0
net.ipv6.conf.ovpntun0.disable_ipv6 = 0
net.ipv6.conf.wlo1.disable_ipv6 = 0

@wesleybl
Copy link
Author

@mickaelistria Is there a possibility that TransportStreams.java is getting the wrong host and port? The debug server appears to start correctly.

@mickaelistria
Copy link
Contributor

I would say everything is possible, but I've tried many times without being able to reproduce that particular problem, CI either, and @AndrewFerr as well; so it's a bit tricky to provide more support, sorry.
Would you like to try debugging Wild Web Developer from source?

@wesleybl
Copy link
Author

Would you like to try debugging Wild Web Developer from source?

I'll try to debug it from the source code.

@wesleybl
Copy link
Author

@mickaelistria I debugged here and the host that arrives at TransportStreams.java is an ipv6: ::1

That doesn't work here. Do you have any tips on how to solve this problem? Could the WWD code force IPv4? Other users may have this same problem.

@mickaelistria
Copy link
Contributor

I merged #1367 to hopefully fix this. Let's wait for CI to complete and please retry with latest build.

@wesleybl wesleybl reopened this Oct 16, 2023
@wesleybl
Copy link
Author

@mickaelistria now I can make the debug. Thanks for the fix!

However, I am experiencing strange behavior when the debug ends. I'll open another issue about this.

@wesleybl
Copy link
Author

@mickaelistria I had the same problem when I tried to use the Running Node.js Application debug:

!ENTRY org.eclipse.core.jobs 4 2 2023-10-17 00:14:44.319
!MESSAGE An internal error occurred during: "Launching New_configuration (1)".
!STACK 0
java.lang.RuntimeException: java.net.ConnectException: Conexão recusada
	at org.eclipse.lsp4e.debug.debugmodel.TransportStreams$SocketTransportStreams.<init>(TransportStreams.java:59)
	at org.eclipse.lsp4e.debug.launcher.DSPLaunchDelegate.lambda$5(DSPLaunchDelegate.java:363)
	at org.eclipse.lsp4e.debug.debugmodel.DSPDebugTarget.<init>(DSPDebugTarget.java:164)
	at org.eclipse.lsp4e.debug.launcher.DSPLaunchDelegate.createDebugTarget(DSPLaunchDelegate.java:388)
	at org.eclipse.lsp4e.debug.launcher.DSPLaunchDelegate.launch(DSPLaunchDelegate.java:370)
	at org.eclipse.wildwebdeveloper.debug.node.NodeAttachDebugDelegate.launch(NodeAttachDebugDelegate.java:114)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:805)
	at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:716)
	at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1038)
	at org.eclipse.debug.internal.ui.DebugUIPlugin$1.run(DebugUIPlugin.java:1241)
	at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)
Caused by: java.net.ConnectException: Conexão recusada
	at java.base/sun.nio.ch.Net.connect0(Native Method)
	at java.base/sun.nio.ch.Net.connect(Net.java:579)
	at java.base/sun.nio.ch.Net.connect(Net.java:568)
	at java.base/sun.nio.ch.NioSocketImpl.connect(NioSocketImpl.java:593)
	at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:327)
	at java.base/java.net.Socket.connect(Socket.java:633)
	at java.base/java.net.Socket.connect(Socket.java:583)
	at java.base/java.net.Socket.<init>(Socket.java:507)
	at java.base/java.net.Socket.<init>(Socket.java:287)
	at org.eclipse.lsp4e.debug.debugmodel.TransportStreams$SocketTransportStreams.<init>(TransportStreams.java:55)
	... 10 more

@wesleybl wesleybl reopened this Oct 17, 2023
@wesleybl
Copy link
Author

wesleybl commented May 7, 2024

Running Node.js Application is working now. Thanks!

@wesleybl wesleybl closed this as completed May 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants