aws-flow-ruby icon indicating copy to clipboard operation
aws-flow-ruby copied to clipboard

Possible race condition in child process cleanup logic

Open gbg6653 opened this issue 9 years ago • 1 comments

If the SIGINT trap here happens to start between these two lines, the workers array possibly contains process IDs belonging to already stopped processes. This results in an Errno::ESRCH exception.

So we're right here: dead_guys = Process.waitall and then the main process receives an INT signal, delegating that to the child processes: Signal.trap("INT") { workers.each { |w| Process.kill("INT", w) } } but the dead PIDs are removed after the very first line: dead_guys.each { |pid, status| workers.delete(pid); puts pid.to_s + " exited" }

gbg6653 avatar Oct 12 '16 11:10 gbg6653

Proposing fix in #120

gbg6653 avatar Oct 12 '16 11:10 gbg6653