Project

General

Profile

Actions

Bug #13916

closed

Race condition when sending a signal to a new fork

Added by russelldavis (Russell Davis) about 7 years ago. Updated over 6 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
[ruby-core:82853]

Description

To reproduce, run this script:

1_000_000.times do |i|
  pid = fork {sleep}
  puts pid
  Process.kill(:TERM, pid)
  Process.wait(pid)
end

Expected behavior: it should print a million pids and then exit.

Actual behavior: after some number of iterations, it freezes on the call to Process.wait, because the fork never got killed by the TERM signal. (I verified with ps that the pid it froze on is still running.)

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0