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 139826 - 60% of time launching debugger fails with Fast Debugger timeout
Summary: 60% of time launching debugger fails with Fast Debugger timeout
Status: RESOLVED FIXED
Alias: None
Product: ruby
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 6.x
Hardware: All All
: P2 blocker (vote)
Assignee: Martin Krauskopf
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-07-14 01:26 UTC by richo
Modified: 2008-07-24 08:11 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
message log from when debugging failed (59.43 KB, text/plain)
2008-07-15 00:08 UTC, richo
Details
message log from when debugging worked (65.53 KB, text/plain)
2008-07-15 00:09 UTC, richo
Details
Plain ruby application failing numerous times to debug, and then finally succeeding (111.76 KB, text/plain)
2008-07-15 00:31 UTC, richo
Details
Log with build netbeans-hudson-trunk-2954-ruby.zip (51.21 KB, text/plain)
2008-07-22 01:29 UTC, richo
Details

Note You need to log in before you can comment on or make changes to this bug.
Description richo 2008-07-14 01:26:07 UTC
Build: netbeans-hudson-trunk-2802-ruby.zip
OS: Ubuntu 8.04 Hardy Heron

When launching the debugger from the IDE *most* of the time I get a fast debugger timeout. The rest of the time it works
perfectly.
Comment 1 richo 2008-07-14 05:06:27 UTC
I pretty sure this is related to using ruby-debug-ide version 0.2.0 which was required by this build of Netbeans. I
reverted to an older build of Netbeans and was having the same problem (whilst debugging rake tasks) until I uninstalled
ruby-debug-ide version 0.2.0 and used the older 0.1.10 version (which works with the older build of netbeans I'm now using)
Comment 2 Martin Krauskopf 2008-07-14 23:22:39 UTC
Hi Richo, I've tried to reproduce, but debugger always started successfully for me. You might try to increase startup
timeout:

  http://wiki.netbeans.org/RubyDebugging#section-RubyDebugging-TimeoutProblem

but that's probably not the culprit.

Then it would help if you reproduce with detailed logging as usual:

  http://wiki.netbeans.org/RubyDebugging#section-RubyDebugging-HowToFileABug

Thanks.
Comment 3 richo 2008-07-15 00:08:59 UTC
Created attachment 64480 [details]
message log from when debugging failed
Comment 4 richo 2008-07-15 00:09:40 UTC
Created attachment 64482 [details]
message log from when debugging worked
Comment 5 richo 2008-07-15 00:13:47 UTC
Netbeans: netbeans-hudson-trunk-2824-ruby.zip

I have attached 2 message logs. One from the debugger timing out and the other with the debugger working fine.

When the debugger works it connects straight away without delay. When it times out it waits the full 15 seconds. 

The logs were grabbed using the following command line:
./netbeans -J-Dorg.netbeans.modules.ruby.level=300
-J-Dorg.netbeans.api.ruby.platform.level=300-J-Dorg.rubyforge.debugcommons.level=300
-J-Dorg.rubyforge.debugcommons.verbose=true          

In each case I just started Netbeans, selected the "Debug Main Project" toolbar button. Waited for it to either succeed
or fail and then close netbeans. One the first run it failed, on the second run it succeeded.               
Comment 6 Martin Krauskopf 2008-07-15 00:18:30 UTC
Could you also provide the content of Output Window when it failed, as described step 3.2:

  http://wiki.netbeans.org/RubyDebugging#section-RubyDebugging-HowToFileABug

Thanks.
Comment 7 Martin Krauskopf 2008-07-15 00:20:15 UTC
PS: are you able to reproduce only with Rails application or also with Ruby non-rails applications?
Comment 8 richo 2008-07-15 00:21:37 UTC
Sorry, forgot to mention that the Output Window is completely blank when it fails.
Comment 9 Martin Krauskopf 2008-07-15 00:24:31 UTC
Sorry, I missed the 'failed' log. So could you attach one more log with at least two more fails. To check whether the
IOException there was RANDOM or not. Thanks.
Comment 10 richo 2008-07-15 00:26:47 UTC
Fails for plain ruby applications in the same way. (Just used the default "hello world" app that netbeans creates)
Comment 11 richo 2008-07-15 00:31:02 UTC
Created attachment 64485 [details]
Plain ruby application failing numerous times to debug, and then finally succeeding
Comment 12 Martin Krauskopf 2008-07-15 00:41:16 UTC
Did you try to run with fresh userdir? By exiting NetBeans and then start it again with passing:

  --userdir /tmp/nb001

or by:

    mv /home/anthony/.netbeans/dev /home/anthony/.netbeans/dev.mk1

and starting it again. Is it the same?
Comment 13 richo 2008-07-15 00:52:16 UTC
I'm pretty sure I had tried a fresh user dir, but to make sure I tried it again. Same problem unfortunately.
Comment 14 Martin Krauskopf 2008-07-15 08:18:21 UTC
Strange, backend starts up correctly in all cases. NetBeans cannot connect for some reason. I'll try to add more logging.

Martine, there are couple of debugger exception and warnings, like:

WARNING [org.netbeans.modules.settings.convertors.XMLSettingsSupport]: Warning:
    unknown module code base: org.netbeans.modules.debugger.jpda.ui in
    MultiFileObject@8d23f9[Windows2Local/Components/sources.settings]

  or

java.io.IOException: Top component sources could not be loaded, either owning
    module was disabled, has incompatible version or top components settings file
    format is broken.
  at o.n.c.windows.persistence.PersistenceManager.getTopComponentPersistentForID(PersistenceManager.java:550)
  at o.n.c.windows.persistence.PersistenceManager.getTopComponentForID(PersistenceManager.java:641)
  at o.n.c.windows.PersistenceHandler.getTopComponentForID(PersistenceHandler.java:422)
  at o.n.c.windows.WindowManagerImpl.getTopComponentForID(WindowManagerImpl.java:782)
  at o.n.c.windows.model.DefaultTopComponentGroupModel.getTopComponent(DefaultTopComponentGroupModel.java:287)
  at o.n.c.windows.model.DefaultTopComponentGroupModel.getTopComponents(DefaultTopComponentGroupModel.java:142)
  at o.n.c.windows.model.DefaultModel.getGroupTopComponents(DefaultModel.java:962)
  at o.n.c.windows.Central.getGroupTopComponents(Central.java:1500)
  at o.n.c.windows.TopComponentGroupImpl.getTopComponents(TopComponentGroupImpl.java:85)
  at o.n.c.windows.Central.openGroup(Central.java:1079)
  at o.n.c.windows.TopComponentGroupImpl.open(TopComponentGroupImpl.java:75)
  at org.netbeans.modules.debugger.ui.DebuggerManagerListener$2.run(DebuggerManagerListener.java:129)
  at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
  at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)

Cannot it be the reason of Ruby debugger failure? Do you want them to file separately or are those OK? Should we check
for something somewhere? Thanks.
Comment 15 Martin Krauskopf 2008-07-17 07:26:56 UTC
Could you evaluate (see my previous comment). Likely something else on our site, but for sanity check... Thanks.
Comment 16 Martin Krauskopf 2008-07-17 22:31:21 UTC
Similar issue 140625 with similar log.
Comment 17 Martin Entlicher 2008-07-18 23:20:30 UTC
If the problem is "java.io.IOException: Top component sources could not be loaded...", then this is a duplicate of issue
#139626, which is already fixed: http://hg.netbeans.org/main/rev/e1c3c4c44697

Can you please test whether that solves this problem? (And please remove also
<user-dir>/config/Windows2Local/Components/sources.settings file for the fix to take effect). Thanks.
Comment 18 Martin Entlicher 2008-07-21 16:55:20 UTC
It does not look like the IOException broke any important thread, but issue #140625 contains the same exception, thus
there seems to be some correlation.
The exception is not thrown after the fix of issue #139626, so can you please test whether it has solved the problem?
Comment 19 richo 2008-07-22 01:29:07 UTC
Created attachment 65185 [details]
Log with build netbeans-hudson-trunk-2954-ruby.zip
Comment 20 richo 2008-07-22 01:30:40 UTC
Netbeans: netbeans-hudson-trunk-2954-ruby.zip

I have added a new log file updated_messages.log

The exception in question does not seem to be appearing anymore, however the problem of debugger failing ot connect most
the time still remains.

Comment 21 richo 2008-07-22 01:45:17 UTC
The debugger fails to connect 75% of the time when running under Ubuntu Hardy's default Sun Java SDK:
  java version "1.6.0_06"
  Java(TM) SE Runtime Environment (build 1.6.0_06-b02)
  Java HotSpot(TM) Client VM (build 10.0-b22, mixed mode, sharing)

The debugger only fails 33% of the time when running under a current beta of the JDK downloaded from Sun:
  java version "1.6.0_10-rc"
  Java(TM) SE Runtime Environment (build 1.6.0_10-rc-b27)
  Java HotSpot(TM) Client VM (build 11.0-b14, mixed mode, sharing)
Comment 22 Martin Krauskopf 2008-07-23 13:17:39 UTC
Likely you will recognize quickly when the debugger will timetout.
So could you try after the unsuccessful start up (which you will recognize, since debugger does not connect immediately)
to connect with telnet to the port, with:

  telnet localhost 36361

replacing '36361' with the number after '-p' argument logged in the "Running" line in the log. So we see whether it is
problem in NetBeans that they cannot connect or in the server that it does not accept connection.

Sanity check - you see 'lo' device when running 'ifconfig', right?
Comment 23 Martin Krauskopf 2008-07-23 13:22:57 UTC
PS: you might increase timeout with to e.g. 120s 

  -J-Dorg.netbeans.modules.ruby.debugger.timeout=120

to have enough time to take a look what port is used and conveniently try to connect with telnet.
Comment 24 richo 2008-07-23 15:30:54 UTC
Unfortunately the port number is not shown in the log/console until after the timeout has occurred.

Just to confirm with the timeout increased to 120 seconds, the debugger still timesout.
Comment 25 Martin Krauskopf 2008-07-23 15:39:44 UTC
Did you turn on logging _for debugger_ as described here?

  http://wiki.netbeans.org/RubyDebugging#section-RubyDebugging-HowToFileABug

Then you should see something like:

  FINE [org.rubyforge.debugcommons.Util]: Running [basedir: /home/emdot/NetBeansProjects/RubyApplication4/lib]:
    "/space/ruby/ruby-current/bin/ruby -I/home/emdot/NetBeansProjects/RubyApplication4/lib
     /tmp/io-synchronizer21166.rb /space/ruby/gem-repo/bin/rdebug-ide _0.2.0_ -p 49175
     -- /home/emdot/NetBeansProjects/RubyApplication4/lib/main.rb"

Which shows port 49175.
Comment 26 richo 2008-07-23 16:31:36 UTC
Even with debugger logging on as per that wiki page I don't get any messages like you suggest.

<snippet of message.log>

<I start debugging>
  FINEST [org.netbeans.modules.ruby.debugger.Util]: Using timeout: 15s
  FINE [org.netbeans.modules.ruby.debugger.Util]: Running fast debugger...
<wait for 20 seconds>
  SEVERE [org.rubyforge.debugcommons.Util]: Error Output: 
  Waiting for connection on 'localhost:50019'
  Fast Debugger (ruby-debug-ide 0.2.0) listens on localhost:50019
<more log data>
Comment 27 Martin Krauskopf 2008-07-23 17:40:19 UTC
That's strange. In first three logs you've attached, in all of them there are lines like:

  FINE [org.rubyforge.debugcommons.Util]: Running [basedir: /home/anthony/workspace/RubyApplication1/lib]:
"/home/anthony/ruby/ruby-1.8.6/bin/ruby -I/home/anthony/workspace/RubyApplication1/lib
-I/home/anthony/workspace/RubyApplication1/test -I/home/anthony/workspace/RubyApplication1/spec -r
/tmp/io-synchronizer17904.rb /home/anthony/ruby/ruby-1.8.6/bin/rdebug-ide _0.2.0_ -p 52994 -d --
/home/anthony/workspace/RubyApplication1/lib/main.rb"

In the latest log you've attached there is no such line, since you did a typo, that you've joined two switches in one:

  -Dorg.netbeans.api.ruby.platform.level=300-J-Dorg.rubyforge.debugcommons.level=300

so they were ignored in the last log. Is not this the reason also now?
Comment 28 richo 2008-07-23 23:57:49 UTC
Doh!

OK, I can see the port now. Telnet connections are being refused as well, so it looks like a problem with the new
ruby-debug-ide.
Comment 29 richo 2008-07-24 02:33:37 UTC
OK, pretty sure I have got to the bottom of this one. My hosts file was missing any IPv4 entries, most importantly

127.0.0.1       localhost

I added this in and the problem seems to be fixed. I noticed in the code of 0.2 ruby-debug-ide there was code added to
explicitly set the host to 'localhost' if it wasn't set to work around some IPv6 issue. Maybe that's why I didn't see
the problem until I upgraded to 0.2.

I'm not sure how these were removed. I checked my Ubuntu 7.10 install and the hosts file is fine there, and checked
another Ubuntu 8.04 install which was also fine. I definitely have not edited the hosts file myself.
Comment 30 Martin Krauskopf 2008-07-24 08:11:02 UTC
Great, it's clear now. Just a little bit strange, that it worked _sometime_. I'll update the wiki page (or you might if
you want):

  http://wiki.netbeans.org/RubyDebugging#section-RubyDebugging-Troubleshooting

The code that has change in ruby-debug-ide is:

    Modified: trunk/ruby-debug-ide/lib/ruby-debug.rb
    ===================================================================
    --- trunk/ruby-debug-ide/lib/ruby-debug.rb  2008-03-10 22:23:05 UTC (rev 395)
    +++ trunk/ruby-debug-ide/lib/ruby-debug.rb  2008-03-13 12:35:49 UTC (rev 396)
    @@ -100,6 +100,7 @@
          raise "Debugger is not started" unless started?
          return if @control_thread
          @control_thread = DebugThread.new do
    +       host ||= 'localhost' # nil does not seem to work for IPv6, localhost does
            Debugger.print_debug("Waiting for connection on '#{host}:#{port}'")
            server = TCPServer.new(host, port)
            while (session = server.accept)

Probably there is a better way(?). Also related to:

  http://www.netbeans.org/issues/show_bug.cgi?id=104473

where one will be able to specify host and port.

Thanks for great feedback as usually ;).