Skip to content

use_process_jobs doesn't work with terminateProcess #196

Description

@TerrorJack
import System.Process

main :: IO ()
main = do
  (_, _, _, ph) <-
    createProcess $
      (proc "sleep" ["21600"]) {use_process_jobs = True}
  terminateProcess ph
  print =<< waitForProcess ph

On Windows, this may either hang indefinitely or crash with thread blocked indefinitely in an MVar operation. See https://github.com/TerrorJack/repro-201111/runs/1385388481?check_suite_focus=true for the CI log of the repro, using Windows 2019/ghc-8.8.4/process-1.6.9.0.

Activity

  1. snoyberg commented on Nov 11, 2020

    @snoyberg
    Collaborator

    CC @Mistuke, do you have any thoughts?

  2. Mistuke commented on Nov 14, 2020

    @Mistuke
    Contributor

    Hmm looks like the RTS thinks it's blocked on a foreign call.. the call to terminateProcess is never made..

            3f70: cap 0: running thread 3 (ThreadRunGHC)
            3f70: cap 0: thread 3 stopped (yielding)
            3f70: cap 0: running thread 3 (ThreadRunGHC)
            3f70: cap 0: thread 3 stopped (blocked on an MVar)
            thread    3 @ 0000000008b05b98 is blocked on an MVar @ 0000000008b07a08 (TSO_DIRTY)
            thread    3 @ 0000000008b05b98 is blocked on an MVar @ 0000000008b07a08 (TSO_DIRTY)
            thread    2 @ 0000000008b05798 is blocked on an external call (TSO_DIRTY)
            4250: cap 0: starting GC
            4250: cap 0: GC working
            4250: cap 0: GC idle
            4250: cap 0: GC done
            4250: cap 0: GC idle
            4250: cap 0: GC done
            4250: cap 0: GC idle
            4250: cap 0: GC done
            4250: cap 0: GC idle
            4250: cap 0: GC done
            4250: resurrecting thread 3
            4250: cap 0: raising exception in thread 3.
    

    Wonder what MVar this is.. I'll investigate next week, bit swamped with work atm.

  3. Mistuke commented on Dec 16, 2020

    @Mistuke
    Contributor

    Ugh sorry had completely forgotten about this issue. Will investigate it tonight.

  4. Mistuke commented on Dec 17, 2020

    @Mistuke
    Contributor

    Ok, looks like a simple bug, it's trying to re-enter a locked mutex. I'll patch it today.

  5. Mistuke commented on Dec 18, 2020

    @Mistuke
    Contributor

    #199 fixes this. Sorry for the delay, have been absolutely swamped with work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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