Bug #2611
closedHang while executing END blocks with redirected stderr
Description
=begin
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 ']
[: ]
[e3]
[ (]
[RuntimeError]
Wrks fine in 1.8.6.
=end
Files
Updated by rogerdpack (Roger Pack) over 15 years ago
=begin
was able to reproduce this for 1.9.1p376 mingw, 1.9.2 mingw (not on linux, though--works fine there).
=end
Updated by naruse (Yui NARUSE) over 15 years ago
- Status changed from Open to Assigned
- Assignee set to usa (Usaku NAKAMURA)
=begin
=end
Updated by wanabe (_ wanabe) over 15 years ago
- File err_print.patch err_print.patch added
- Assignee changed from usa (Usaku NAKAMURA) to ko1 (Koichi Sasada)
=begin
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?
=end
Updated by wanabe (_ wanabe) about 15 years ago
=begin
I don't know my patch is good solution, But I think that it is not harmful.
I will commit the patch this weekend, unless any objection.
Anyone, Any comment?
=end
Updated by wanabe (_ wanabe) almost 15 years ago
- Status changed from Assigned to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r28368.
Tomas, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end