Bug #15013
closed
thread_pthread.c: reinitialize ubf_list at fork
Added by normalperson (Eric Wong) over 6 years ago.
Updated over 5 years ago.
Description
thread_pthread.c: reinitialize ubf_list at fork
It's possible for the ubf_list_head to be populated with dead
threads at fork or the ubf_list_lock to be held, so reinitialize
both at startup.
And while we're at it, use a static initializer at startup
to save a library call and kill some ifdef.
Files
- Status changed from Open to Closed
Applied in changeset trunk|r64485.
thread_pthread.c: reinitialize ubf_list at fork
It's possible for the ubf_list_head to be populated with dead
threads at fork or the ubf_list_lock to be held, so reinitialize
both at startup.
And while we're at it, use a static initializer at startup
to save a library call and kill some ifdef.
[ruby-core:88578] [Bug #15013]
MEMO: backporting r64485 and r64635 cause some make test failures on my environment.
I give up to fix these for just now.
#257 test_fork.rb:31:in `<top (required)>':
begin
r, w = IO.pipe
if pid1 = fork
w.close
r.read(1)
Process.kill("USR1", pid1)
_, s = Process.wait2(pid1)
s.success? ? :ok : :ng
else
r.close
if pid2 = fork
trap("USR1") { Time.now.to_s; Process.kill("USR2", pid2) }
w.close
Process.wait2(pid2)
else
w.close
sleep 0.2
end
exit true
end
rescue NotImplementedError
:ok
end
#=> "ng" (expected "ok") [ruby-core:28924]
stderr output is not empty
bootstraptest.tmp.rb:13:in `kill': No such process (Errno::ESRCH)
from bootstraptest.tmp.rb:13:in `block in <main>'
from bootstraptest.tmp.rb:15:in `wait2'
from bootstraptest.tmp.rb:15:in `<main>'
test_fork.rb FAIL 1/5
#455 test_io.rb:87:in `block in <top (required)>':
at_exit { p :foo }
megacontent = "abc" * 12345678
#File.open("megasrc", "w") {|f| f << megacontent }
t0 = Thread.main
Thread.new { sleep 0.001 until t0.stop?; Process.kill(:INT, $$) }
r1, w1 = IO.pipe
r2, w2 = IO.pipe
t1 = Thread.new { w1 << megacontent; w1.close }
t2 = Thread.new { r2.read; r2.close }
IO.copy_stream(r1, w2) rescue nil
w2.close
r1.close
t1.join
t2.join
#=> killed by SIGKILL (signal 9) (timeout) megacontent-copy_stream
test_io.rb FAIL 1/9
FAIL 2/1201 tests failed
Also available in: Atom
PDF
Like0
Like0Like0