Project

General

Profile

Actions

Bug #2611

closed

Hang while executing END blocks with redirected stderr

Added by tmat (Tomas Matousek) over 15 years ago. Updated about 14 years ago.

Status:
Closed
Target version:
-
ruby -v:
ruby 1.9.1p129 (2009-05-12 revision 23412) [i386-mswin32]
Backport:
[ruby-core:27608]

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

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

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

Actions #2

Updated by naruse (Yui NARUSE) over 15 years ago

  • Status changed from Open to Assigned
  • Assignee set to usa (Usaku NAKAMURA)

=begin

=end

Actions #3

Updated by wanabe (_ wanabe) over 15 years ago

=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

Actions #4

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

Actions #5

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

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0