Skip to content
This repository was archived by the owner on Jan 10, 2019. It is now read-only.
This repository was archived by the owner on Jan 10, 2019. It is now read-only.

Possible race condition in child process cleanup logic #119

@borsothy

Description

@borsothy

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" }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions