Skip to content

waitForProcess race condition #46

@joeyh

Description

@joeyh
    -- don't hold the MVar while we call c_waitForProcess...
    -- (XXX but there's a small race window here during which another
    -- thread could close the handle or call waitForProcess)

This is a small race condition indeed, but today I managed to stumble over it, on a Linux system. I have a situation where 2 threads both need to wait for the same process to exit, so both call waitForProcess. One of the threads would then fairly reliably crash with "waitForProcess: does not exist (No child processes)"

Of course, I can work around it in my code by adding my own locking so only 1 thread calls waitForProcess on a process at a time. It could be similarly fixed in System.Process.. add another MVar to ProcessHandle, and make waitForProcess use it to prevent concurrent calls to c_waitForProcess

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