Bug #2611 [ruby-core:27608]

Hang while executing END blocks with redirected stderr

Added by Tomas Matousek 61 days ago. Updated 50 days ago.

Status :Assigned Start :01/17/2010
Priority :Normal Due date :
Assigned to :Koichi Sasada % Done :

0%

Category :-
Target version :-
ruby -v :

ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mswin32]


Description

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.

err_print.patch (561 Bytes) _ wanabe, 01/28/2010 07:19 PM

History

01/27/2010 09:59 AM - Roger Pack

was able to reproduce this for 1.9.1p376 mingw, 1.9.2 mingw (not on linux, though--works fine there).

01/27/2010 04:15 PM - Yui NARUSE

  • Status changed from Open to Assigned
  • Assigned to set to Usaku NAKAMURA

01/28/2010 07:19 PM - _ wanabe

  • File err_print.patch added
  • Assigned to changed from Usaku NAKAMURA to Koichi Sasada
I reproduced it on Ubuntu 9.10 by adding "sleep 0.01" at the first line of C#write.

blocking_region_begin() can't stop with th->raised_flag and th->interrupt_flag,
so raised_flag should be clear before entering blocking-region, I guess.

I wrote a patch, but it's doubtful that this is correct.
ko1, How do you think this issue?

Also available in: Atom PDF