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 52346 - Change of debug port is not reflected
Summary: Change of debug port is not reflected
Status: CLOSED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: Infrastructure (show other bugs)
Version: 4.x
Hardware: PC All
: P2 blocker (vote)
Assignee: _ ludo
URL:
Keywords:
: 52393 (view as bug list)
Depends on: 53721
Blocks:
  Show dependency tree
 
Reported: 2004-12-13 17:56 UTC by L Martinek
Modified: 2006-03-24 13:03 UTC (History)
1 user (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 L Martinek 2004-12-13 17:56:30 UTC
[NetBeans 4.0 FCS, JDK 1.4.2_06]

1. Start AppServer
2. Open properties of JVMs node and change value
of jpds_port_number property.
3. Stop Server
4. Debug project. Debugger tries to connect to old
port number.
Comment 1 Martin Grebac 2004-12-14 08:54:53 UTC
LiboreM, there's a difference in which kind of project you are trying
to debug. Was it a web project? Please provide full info. Thanks.
Comment 2 L Martinek 2004-12-14 09:52:10 UTC
I debugged "Web Application" created by wizard.
Comment 3 L Martinek 2004-12-14 12:23:14 UTC
The problem is al little bit complicated.

When appserver is running and I change debug port number, this change
is propagated to debugger. When I start debugger (without appserver
restart), debugger tries to connect to new port number, but appserver
is still running with old port number so connection fails. In tomcat,
it's solved by disabling properties change when tomcat is running. If
you do this for appserver, you would not be able to change properties
at all, because properties are not available when appserver is not
running.

On the contrary, there is another problem. If I manually stop server
after debug port number change and start debugger, appserver is
started properly with new debug port number, but debugger connects to
old port number. So connection fails again.

Result is that I am not able to change debug port at all.
Comment 4 L Martinek 2004-12-14 12:38:52 UTC
Small correction: If I change debug port and manually stop server then
debugger tries always to connect to port 1044, whatever old port was.
Second debugger start is OK and debugger connects to new port.
Comment 5 _ ludo 2004-12-14 20:53:33 UTC
On Windows, the plugin automatically changes the debug setting from
dt_socket to sh_mem because of a JDK bug that would prevent further
debugging...

So If you have on windows, you cannot use dt_socket and the app server 8.

If this the case?
See bugs 4989322 and  5029980 jdk 1.4 bug)(
http://andorra1.sfbay:8080/cgi-bin/ws.exe/bugtraq/jdk/bug.hts?bugid_value=4989322
http://andorra1.sfbay:8080/cgi-bin/ws.exe/bugtraq/jdk/bug.hts?bugid_value=5029980


and
http://andorra1.sfbay:8080/cgi-bin/ws.exe/bugtraq/jdk/bug.hts?bugid_value=5008234


Thanks,
Comment 6 L Martinek 2004-12-15 10:53:22 UTC
This issue is for all OSs and is about socket debugging. You probably
wanted to reply on issue #52393, which is exectly what you discribed.
Comment 7 _ ludo 2004-12-21 21:18:29 UTC
Cannto fix for the 4.0 release.

Need release notes.

For 4.1 we might remove this logic since the latest JDK 1.5 has the fix.
Comment 8 L Martinek 2004-12-22 12:45:55 UTC
Are you still talking about this bug? What logic? This bug is about
that sometimes the debugger tries to connect to port 1044 regardless
what is set in properties. But when I tried it with plugin 041222 I
wasn't able to reproduce it so it's probably fixed.
Comment 9 _ ludo 2005-01-04 17:17:58 UTC
fixed in the 4.0 plugin...We cache the debug info in the user settings.

Still same issue in the 4.1 code base, so we might want to open
another bug there... The real fix then will be to fix someting in
J2EEServer module to query for the debug info after the server is
started and not before.
Comment 10 L Martinek 2005-01-05 12:36:12 UTC
I verified it's fixed in 4.0. It's still present in 4.1 so I am
reopening this bug to be fix in 4.1. 
Comment 11 _ ludo 2005-01-08 00:39:34 UTC
*** Issue 52393 has been marked as a duplicate of this issue. ***
Comment 12 _ ludo 2005-01-20 19:58:17 UTC
This is because getDebugInfo() is always called with a NULL Target

This is wrong, it sohuld be called:
1/ only when the target is running
2/ with the correct target.
The plugin needs ther target to be running to query its debug values.
I did a hack in nb4.0 to locally store the valuees, but we need to fix
the bug in j2eeserver.
BTW, this was working in nb3.6 ans is a regression
http://www.netbeans.org/download/dev/javadoc/J2EEServerAPI/org/netbeans/modules/j2ee/deployment/plugins/api/StartServer.html#getDebugInfo(javax.enterprise.deploy.spi.Target)
Comment 13 Nam Nguyen 2005-01-20 21:09:09 UTC
The problem is dual, both in webproject (and other devmodules) and
j2eeserver.  The fix in j2eeserver for calling getDebugInfo with
non-null target is trivial.  I could check in the change tonight.

The other part involving restart server instance is more
controversial.  Currently devmodule build-impl.xml call jpda tasks
asking for debuginfo way before nbdeploy, while restart/start only
happen during nbdeploy.  We have 3 fix options:
(1) move the init for jpda.host/address till after nbdeploy.
(2) check and start/restart during
J2eeModuleProvider.getServerDebugInfo() before query and return debuginfo.
(3) plugin start/restart server in debug mode immediately when user
change debug port.

Since options (2) and (3) have UI ugliness, (1) seems to be best and
simple solution.


Comment 14 _ ludo 2005-01-21 01:31:02 UTC
go for 1/
Comment 15 Nam Nguyen 2005-01-21 19:30:19 UTC
Checked in j2eeserver and web/project changes.  This main test case
will work.  

/cvs/j2eeserver/src/org/netbeans/modules/j2ee/deployment/devmodules/spi/J2eeModuleProvider.java,v
 <--  J2eeModuleProvider.java
new revision: 1.40; previous revision: 1.39
/cvs/j2eeserver/ant/antsrc/org/netbeans/modules/j2ee/ant/Deploy.java,v
 <--  Deploy.java
new revision: 1.17; previous revision: 1.16
/cvs/web/project/src/org/netbeans/modules/web/project/WebActionProvider.java,v
 <--  WebActionProvider.java
new revision: 1.50; previous revision: 1.49
Comment 16 Nam Nguyen 2005-01-21 19:33:23 UTC
For completeness, we still need to have plugin implement
StartServer.needsRestart and the test case for that would be changing
debug port while already in debug mode (sounds not very interesting
use case though).
Also, same test case but with other j2ee projects (ejbjarproject,
earproject).  I only did web/project.
Comment 17 _ ludo 2005-01-26 01:47:17 UTC
Fixed in the plugin repository for now.
Will check in later in nb_all
Comment 18 _ ludo 2005-01-28 23:11:12 UTC
fixed, we implement now correctly StartServer.needsRestart
Comment 19 L Martinek 2005-02-08 14:16:01 UTC
verified