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 155922 - When debugger dies, debug-synchronizer is not killed
Summary: When debugger dies, debug-synchronizer is not killed
Status: NEW
Alias: None
Product: ruby
Classification: Unclassified
Component: Debugger (show other bugs)
Version: 6.x
Hardware: All Linux
: P3 blocker (vote)
Assignee: issues@ruby
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-22 08:20 UTC by esmithbss
Modified: 2011-01-28 20:12 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Log File with extended logging information (556.13 KB, text/plain)
2008-12-23 09:37 UTC, esmithbss
Details

Note You need to log in before you can comment on or make changes to this bug.
Description esmithbss 2008-12-22 08:20:58 UTC
When debugging, if the debugger experiences an exception, the debugger communications connection is lost; however the
io-synchronizer used to communicate with the debugger remains open with the port locked.

The io-synchronizer is a child process of NetBeans and not the Debugger so in the event that communications with the
debugger is lost, the io-synchronizer must be terminated properly.  If not, then:

1) the port remains "eaten" by the synchronizer
2) subsequent attempts to debug the application end up on different ports
3) Users get confused when they specify one port, and end up debugging on a different port.
Comment 1 Martin Krauskopf 2008-12-22 12:42:06 UTC
I do not see (and cannot reproduce) the problem. Could you be more specific? How debugging works is that NetBeans
starts-up 'rdebug-ide' process and then connects to it. Then rdebug-ide should run as long as the underlying debuggee
(being debugged process) runs. Once the debuggee finishes (killed or properly), the rdebug-ide should finish and socket
communication should be lost and NetBeans disconnects.

Do you have some reproducible scenario how could I check it. Thanks.
Comment 2 esmithbss 2008-12-23 02:57:35 UTC
It's not forcibly reproducible; however, it is reproducible.  When I'm debugging an application and the debugger
experiences an abnormal condition, it will detach from the IDE.  After this occurs, I can go into the command line and
search for processes which are using the port.  I will find one process which uses the port and must be killed.
Comment 3 esmithbss 2008-12-23 08:48:42 UTC
I have been able to duplicate this issue most frequently by examining (within the local variables window) the fields of
a new record just prior to saving it.  This isn't a guaranteed way to make this happen, but it is the most common for me.

What appears to happen is:

The process that is hanging is the ruby process that was started behind the rdebug-ide process (see pasted ps line below)

So what appears to be happening is that the rdebug-ide is crashing but the background application is remaining in a
running state.  Don't know what can be done except to do a scan of the process table and if something was launched by
the rdebug-ide process on NetBeans behalf, then it needs to be killed as well.


Pasted from call to "ps -ef | grep 3000":

esmith    6291     1  1 02:38 ?        00:00:04 /usr/local/bin/ruby -r /tmp/io-synchronizer914.rb
/usr/local/bin/rdebug-ide _0.3.1_ -p 54900 -- script/server --port 3000
esmith    6959  6775  0 02:43 pts/0    00:00:00 grep 3000
Comment 4 Martin Krauskopf 2008-12-23 08:57:47 UTC
If you would catch more specific information about "an abnormal condition" it would help. I know there are some
stability issues in the debugger. I'll try to simulate crash from withing the debugger backend code and see what's
happening. I get a SEGFAULT  from time to time (due to http://redmine.ruby-lang.org/issues/show/728) but not sure
whether sometime I've got into the same situation like here. Will try watch processes table a bit more.

You might also try to install newer ruby-debug-ide and ruby-debug-base. There is ruby-debug-ide 0.3.3. 0.3.2 switched
dependency to ruby-debug-base 0.10.3 where was several bugs fixed.
Comment 5 esmithbss 2008-12-23 09:35:54 UTC
I'm attaching a detailed IDE log (extra ruby debug info).

I can consistently cause the crash of rdebug-ide now by looking at the new_record prior to saving it.

It appears that the debugger thinks it should exit (as if it received a termination signal) as the last line of the log is :

FINEST [org.rubyforge.debugcommons.RubyDebuggerProxy]: Socket reader loop finished.

Comment 6 esmithbss 2008-12-23 09:37:21 UTC
Created attachment 75263 [details]
Log File with extended logging information
Comment 7 esmithbss 2008-12-23 09:42:05 UTC
It appears that somewhere in the attempt to view the object within the Local Variables Window, the following message is
generated:

Processing: frame 1; v i -0x24c53fac
Processing context: frame 1
Selected frame no 0
Processing context:  v i -0x24c53fac
<variables>
Evaluating with timeout after 10 sec
<variable name="@attributes" kind="instance" value="Hash (6 element(s))" type="Hash" hasChildren="true"
objectId="-0x24c53ffc"/>
Evaluating with timeout after 10 sec
<variable name="@attributes_cache" kind="instance" value="Empty Hash" type="Hash" hasChildren="false"
objectId="-0x24c53fde"/>
Evaluating with timeout after 10 sec
<variable name="@changed_attributes" kind="instance" value="Hash (1 element(s))" type="Hash" hasChildren="true"
objectId="-0x249be2ce"/>
Evaluating with timeout after 10 sec


You have a nil object when you didn't expect it!
You might have expected an instance of Array.
The error occurred while evaluating nil.empty?


<variable name="@errors" kind="instance" value="#&lt;ActiveRecord::Errors:0xb6c8128c&gt;" type="ActiveRecord::Errors"
hasChildren="true" objectId="-0x249bf6ba"/>
Evaluating with timeout after 10 sec
<variable name="@membership" kind="instance" value="#&lt;Membership:0xb698ff10&gt;" type="Membership" hasChildren="true"
objectId="-0x24afa20a"/>
Evaluating with timeout after 10 sec
</variables>

I just don't know what is actually generating this message.
Comment 8 Martin Krauskopf 2008-12-23 09:46:04 UTC
Those might be problematic:

  Evaluating with timeout after 10 sec
  You have a nil object when you didn't expect it!
  You might have expected an instance of Array.
  The error occurred while evaluating nil.empty?

Will take a look at the evaluation code.
Comment 9 Martin Krauskopf 2008-12-23 09:47:22 UTC
I've missed your last comment, you were faster ;)
Comment 10 esmithbss 2008-12-23 09:51:16 UTC
The debugger detachment with a hanging process can be easily identified when the debug toolbar vanishes, but the bottom
right corner indicates the process is still running.
Comment 11 esmithbss 2008-12-23 10:01:20 UTC
The crash is caused by viewing the local variable when (and only when) it is a new record and has been added to the
collection of another record prior to saving:

i.e:
@record2 = Record2.new
@record1.collection_of_record2 << @record2
if @record2.save              <============ Look at @record2 here.
...
end
Comment 12 Martin Krauskopf 2008-12-23 10:38:42 UTC
Great, thanks for details. Considered started. If I reproducible for me, will try to fix it either today or after
Christmas ;)