Project

General

Profile

Bug #14563

irb in irb raises a FATAL error

Added by hkdnet (Ko Sato) over 1 year ago. Updated 4 months ago.

Status:
Open
Priority:
Normal
Assignee:
-
Target version:
-
ruby -v:
ruby 2.6.0preview1 (2018-02-24 trunk 62554) [x86_64-darwin17]
[ruby-core:85878]

Description

Start irb in irb, then C-c and C-d cause a fatal error.

$ irb
irb(main):001:0> irb
irb#1(main):001:0> ^C
irb#1(main):001:0>
Traceback (most recent call last):
       16: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/ruby-lex.rb:232:in `block in each_top_level_statement'
       15: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/ruby-lex.rb:232:in `loop'
       14: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/ruby-lex.rb:246:in `block (2 levels) in each_top_level_statement'
       13: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb.rb:488:in `block in eval_input'
       12: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb.rb:623:in `signal_status'
       11: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb.rb:491:in `block (2 levels) in eval_input'
       10: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/context.rb:380:in `evaluate'
        9: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/workspace.rb:85:in `evaluate'
        8: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/workspace.rb:85:in `eval'
        7: from (irb):1:in `irb_binding'
        6: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/extend-command.rb:154:in `irb'
        5: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/extend-command.rb:151:in `irb'
        4: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/cmd/nop.rb:20:in `execute'
        3: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/cmd/subirb.rb:20:in `execute'
        2: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/ext/multi-irb.rb:229:in `irb'
        1: from /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/ext/multi-irb.rb:229:in `stop'
fatal (No live threads left. Deadlock?)
1 threads, 1 sleeps current:0x00007fb05e106870 main thread:0x00007fb05e106870
* #<Thread:0x00007fb05e87db40 sleep_forever>
   rb_thread_t:0x00007fb05e106870 native:0x00007fffae08a340 int:0
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/ext/multi-irb.rb:229:in `stop'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/ext/multi-irb.rb:229:in `irb'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/cmd/subirb.rb:20:in `execute'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/cmd/nop.rb:20:in `execute'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/extend-command.rb:151:in `irb'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/extend-command.rb:154:in `irb'
   (irb):1:in `irb_binding'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/workspace.rb:85:in `eval'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/workspace.rb:85:in `evaluate'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/context.rb:380:in `evaluate'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb.rb:491:in `block (2 levels) in eval_input'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb.rb:623:in `signal_status'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb.rb:488:in `block in eval_input'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/ruby-lex.rb:246:in `block (2 levels) in each_top_level_statement'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/ruby-lex.rb:232:in `loop'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/ruby-lex.rb:232:in `block in each_top_level_statement'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/ruby-lex.rb:231:in `catch'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb/ruby-lex.rb:231:in `each_top_level_statement'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb.rb:487:in `eval_input'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb.rb:428:in `block in run'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb.rb:427:in `catch'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb.rb:427:in `run'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/lib/ruby/2.6.0/irb.rb:383:in `start'
   /Users/hkdnet/.anyenv/envs/rbenv/versions/2.6.0-preview1/bin/irb:11:in `<main>'
Maybe IRB bug!
irb(main):002:0>

History

Updated by jeremyevans0 (Jeremy Evans) 4 months ago

I was able to reproduce this issue with the current master branch. I'm not sure why it occurs, though. The thread that is stopped (the main thread) is woken up by the thread that IRB.irb spawns before that thread exits. So I am not sure why this would cause deadlock. Interestingly, this issue only occurs on the first nesting. If you nest irb twice, then do Ctrl-C, Ctrl-D, it does not cause an error.

Also available in: Atom PDF