This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 237184 - Can not attach debugger
Summary: Can not attach debugger
Status: REOPENED
Alias: None
Product: debugger
Classification: Unclassified
Component: Java (show other bugs)
Version: 7.4
Hardware: PC Linux
: P3 normal with 2 votes (vote)
Assignee: Martin Entlicher
URL:
Keywords:
: 235186 (view as bug list)
Depends on:
Blocks:
 
Reported: 2013-10-16 10:00 UTC by Ondrej Brejla
Modified: 2015-09-04 14:10 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ondrej Brejla 2013-10-16 10:00:38 UTC
I run my dev IDE with this options: -J-agentlib:jdwp=transport=dt_socket,server=y,address=warden-oracle:8000,suspend=n

And when I try to attach a debugger in 7.4: JPDA, SocketAttach, dt_socket, warden-oracle, 8000

It doesn't work. I just get "Malformed reply from SOCKS server" message in status bar (just for a second).

Am I doing something wrong (that's definitely possible ;)? Or can I provide some more info? It seems that there is nothing useful in IDE log.

Same setup works without any problem in 7.3.1 (and in older versions as well).

Thanks in advance.
Comment 1 srlamb76 2013-10-16 21:20:23 UTC
I am also experiencing the same behaviour performing a dt_socket attach.
Comment 2 FoxXav 2013-10-17 10:01:15 UTC
In 7.4RC2 attaching a debugger was working but not anymore in the final release.
The debugger initialize but then a timeout occure and no debug possible.

I hope there will be a correction soon.

See you
Comment 3 Ondrej Brejla 2013-10-29 10:12:29 UTC
It's really annoying to start 7.3.1 when one needs to use debugger :(
Comment 4 FoxXav 2013-11-04 09:45:47 UTC
Is it possible to have information about this issu ?
Comment 5 Martin Entlicher 2013-11-05 17:48:13 UTC
For me, NetBeans 7.3 and 7.4 behave exactly in the same way.

When I run one instance of NetBeans (or any Java application) with
-J-agentlib:jdwp=transport=dt_socket,server=y,address=martin-Latitude:8000,suspend=n
and then try to attach to host "martin-Latitude" and port "8000", I get:
Connection refused.

When I attach to host "localhost" and port "8000" it works.

But this is not NetBeans-specific.

When I run:

$ java -classpath /tmp/NetBeansProjects/AnagramGame/build/classes -agentlib:jdwp=transport=dt_socket,server=y,address=martin-Latitude:7000,suspend=n com.toy.anagrams.ui.Anagrams

Then: $ jdb -attach martin-Latitude:7000
it gives me:
java.net.ConnectException: Connection refused
	at java.net.PlainSocketImpl.socketConnect(Native Method)
        ....
Fatal error:
Unable to attach to target VM.


When I try to attach to localhost instead:

$ jdb -attach localhost:7000
Set uncaught java.lang.Throwable
Set deferred uncaught java.lang.Throwable
Initializing jdb ...
> 
=> it works.

Therefore the behavior in NetBeans is consistent with the behavior in jdb.

Please verify the actual behavior with jdb before submitting bugs to NetBeans.

P.S.: java and jdb are from jdk1.7.0_40 in my case.
Comment 6 Martin Entlicher 2013-11-05 22:17:55 UTC
Or try -J-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n
(omit the host name)
and then attach to Host: warden-oracle, Port: 8000

At least, this is what works for me as well.

I know, that it's illogical, but you simply need to figure out the combination that works for you. I do not think I can do anything particular about it.

Should you find any difference in the attach ability between jdb and NetBeans, then let me know.
Comment 7 FoxXav 2013-11-06 09:06:46 UTC
I will make some try during lunch. But it didn't explain why with the same tomcat configuration (./startup.sh jpda) with netbeans 7.4RC2 attaching a debugger work out of the box and not with Netbeans 7.4 final.
Comment 8 Ondrej Brejla 2013-11-06 09:52:35 UTC
When I try:

1) jdb -attach warden-oracle:8000
It works.

2) jdb -attach localhost:8000
It doesn't work: java.net.ConnectException: Spojení odmítnuto

3) connect with 7.3.1, with warden-oracle and 8000
It works.

4) connect with 7.3.1, with localhost and 8000
It doesn't work: Connection refused

5) connect with 7.4, with warden-oracle and 8000
It doesn't work: Malformed reply from SOCKS server

6) connect with 7.4, with localhost and 8000
It doesn't work: Connection refused




In all cases 1.7.0_45-b18 is used.

And the only difference is in connectiong via NB 7.4. So there has to be something suspicious :/ Don't you have any other ideas?
Comment 9 Ondrej Brejla 2013-11-06 10:16:09 UTC
Well, so after discussion, the working solution for me is this setup:

1) run debugged application just with a port in address option:

-J-agentlib:jdwp=transport=dt_socket,server=y,address=8000,suspend=n

2) attach with NB 7.4 with Host: localhost

Then it works. But really strange behavior ;) Thanks.
Comment 10 FoxXav 2013-11-06 14:57:43 UTC
It seems that using localhost instead of machine name or 127.0.0.1 it works to attach a jpda debugger on local tomcat for example launch in jpda debug mode.
Comment 11 Martin Entlicher 2013-11-06 15:29:23 UTC
=> P2, there's a workaround.

I've added a debug message, that can be used to verify arguments that were passed to the attaching connector. It also prints the exception body. Both information is logged into messages.log file.
changeset:   266954:6327d0d12915
http://hg.netbeans.org/core-main/rev/6327d0d12915
This will be in NetBeans 8.0 dev version, should be available in the next nightly build.
Comment 12 Quality Engineering 2013-11-08 03:54:29 UTC
Integrated into 'main-silver', will be available in build *201311080001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)

Changeset: http://hg.netbeans.org/main-silver/rev/6327d0d12915
User: mentlicher@netbeans.org
Log: #237184: Print connector, it's arguments and exception stack trace into messages.log file when the attach fails.
Comment 13 Martin Entlicher 2013-11-15 09:20:48 UTC
Re-scheduling for the patch2. We do not know why the behavior differs between 7.3 and 7.4 yet. Providing messages.log file from a trunk build where the logging was added might help.
Comment 14 Martin Entlicher 2014-02-25 16:49:56 UTC
Unfortunately, we were not able to identify the problem yet. I had a suspicion that changes in core.network module could have an impact on this, but this was not confirmed.
Omitting the host name seems to be a working workaround, reducing to P3.
Comment 15 Martin Entlicher 2015-09-04 14:10:55 UTC
*** Bug 235186 has been marked as a duplicate of this bug. ***