No waiters on channel #5

Closed
rocky opened this Issue Feb 9, 2013 · 0 comments

Projects

None yet

2 participants

@rocky
Owner

Many times when starting the debugger from the outset we are getting No waiters meesage from rubinius and the program doesn't stop. This message means rubinius is trying to send debug information on a channel that isn't waiting to receive information.

Here's an example:

$ ./bin/trepanx test/example/gcd.rb 
-> (/src/external-vcs/github/rbx-trepanning/test/example/gcd.rb:4 @0)
def gcd(a, b)
(trepanx): q!
trepanx: That's all, folks...
$ !!
./bin/trepanx test/example/gcd.rb 
no waiters
An exception occurred running ./bin/trepanx
    undefined method `>' on nil:NilClass. (NoMethodError)

Backtrace:
  Kernel(NilClass)#> (method_missing) at kernel/delta/kernel.rb:81
                           Object#gcd at test/example/gcd.rb:6
                    Object#__script__ at test/example/gcd.rb:19
                          Kernel.load at kernel/common/kernel.rb:598
     Trepanning(Object)#debug_program at app/run.rb:51
             { } in Object#__script__ at bin/trepanx:66
                Integer(Fixnum)#times at kernel/common/integer.rb:83
                    Object#__script__ at bin/trepanx:21
     Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:68
     Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:118
              Rubinius::Loader#script at kernel/loader.rb:615
                Rubinius::Loader#main at kernel/loader.rb:816
trepanx: That's all, folks...
$ !!
./bin/trepanx test/example/gcd.rb 
-> (/src/external-vcs/github/rbx-trepanning/test/example/gcd.rb:4 @0)
def gcd(a, b)
(trepanx): q!
trepanx: That's all, folks...
$ !!
./bin/trepanx test/example/gcd.rb 
no waiters
An exception occurred running ./bin/trepanx
    undefined method `>' on nil:NilClass. (NoMethodError)

Backtrace:
  Kernel(NilClass)#> (method_missing) at kernel/delta/kernel.rb:81
                           Object#gcd at test/example/gcd.rb:6
                    Object#__script__ at test/example/gcd.rb:19
                          Kernel.load at kernel/common/kernel.rb:598
     Trepanning(Object)#debug_program at app/run.rb:51
             { } in Object#__script__ at bin/trepanx:66
                Integer(Fixnum)#times at kernel/common/integer.rb:83
                    Object#__script__ at bin/trepanx:21
     Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:68
     Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:118
              Rubinius::Loader#script at kernel/loader.rb:615
                Rubinius::Loader#main at kernel/loader.rb:816
trepanx: That's all, folks...
$ !!
./bin/trepanx test/example/gcd.rb 
-> (/src/external-vcs/github/rbx-trepanning/test/example/gcd.rb:4 @0)
def gcd(a, b)
(trepanx): q!
trepanx: That's all, folks...
$ !!
./bin/trepanx test/example/gcd.rb 
no waiters
no waiters
An exception occurred running ./bin/trepanx
    undefined method `>' on nil:NilClass. (NoMethodError)

Backtrace:
  Kernel(NilClass)#> (method_missing) at kernel/delta/kernel.rb:81
                           Object#gcd at test/example/gcd.rb:6
                    Object#__script__ at test/example/gcd.rb:19
                          Kernel.load at kernel/common/kernel.rb:598
     Trepanning(Object)#debug_program at app/run.rb:51
             { } in Object#__script__ at bin/trepanx:66
                Integer(Fixnum)#times at kernel/common/integer.rb:83
                    Object#__script__ at bin/trepanx:21
     Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:68
     Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:118
              Rubinius::Loader#script at kernel/loader.rb:615
                Rubinius::Loader#main at kernel/loader.rb:816
trepanx: That's all, folks...
$ 

I believe specifically this is because we call skip_loader() in lib/trepanning.rb around line 163. That issues 3 next commands and one skip command and some combination of those fail. All we need is one of these to fail and the debugger is toast. Comment out the call to skip loader at line 201:

skip_loader if @settings[:skip_loader]

and the debugger will stop. However the step and next commmands may fail subsequently.

This behavior of next or step failing I have also noticed in the reference debugger.

This leads me to believe that there may be a bug in the channel code or the pattern I copied in using the channel receive code which is also in lib/trepanning.rb in methods listen(), spinup_thread() and debugger()

It would be good to isolate this code into its own package and make the interface something like:

set_trace_func(:trace_method_name) 

The name set_trace_func() is not the greatest name, but it matches what Ruby calls it. The name Python uses is sys.settrace().

@brixen brixen was assigned Feb 9, 2013
@rocky rocky closed this Jul 14, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment