Bug #2611: Hang while executing END blocks with redirected stderr
http://redmine.ruby-lang.org/issues/show/2611

Author: Tomas Matousek
Status: Open, Priority: Normal
Category: core
ruby -v: ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mswin32]

The following code hangs with CPU on 100% at a random point during execution of END blocks.

class C
  def write(x)
    puts "[#{x}]"
  end
end

$stderr = C.new

END {
  raise 'e1'
}
END {
  puts 'e2'
}
END {
  raise 'e3'
}
END {
  puts 'e4'
}
END {
  raise 'e5'
}


output:

ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mswin32]
[END_exceptions.rb:22:in `block in <main>']
[: ]
[e5]
[ (]
[RuntimeError]
[)
]
e4
[END_exceptions.rb:16:in `block in <main>']
[: ]
[e3]
[ (]
[RuntimeError]

---
Wrks fine in 1.8.6.


----------------------------------------
http://redmine.ruby-lang.org