input-output-hk / io-sim

Haskell's IO simulator which closely follows core packages (base, async, stm).
https://hackage.haskell.org/package/io-sim
Apache License 2.0
37 stars 15 forks source link

deadlock in registerDelayCancellable in `io-sim` #85

Closed coot closed 1 year ago

coot commented 1 year ago

Describe the bug

    MonadTimerCancellable
test: BlockedIndefinitely {blockedIndefinitelyCallStack = [("wrapBlockedIndefinitely",SrcLoc {srcLocPackage = "io-classes-0.6.0.0-inplace", srcLocModule = "Control.Monad.Class.MonadSTM.Internal", srcLocFile = "src/Control/Monad/Class/MonadSTM/Internal.hs", srcLocStartLine = 653, srcLocStartCol = 16, srcLocEndLine = 653, srcLocEndCol = 39}),("atomically",SrcLoc {srcLocPackage = "main", srcLocModule = "Test.Control.Monad.IOSim", srcLocFile = "test/Test/Control/Monad/IOSim.hs", srcLocStartLine = 276, srcLocStartCol = 6, srcLocEndLine = 276, srcLocEndCol = 32})], blockedIndefinitelyException = thread blocked indefinitely in an STM transaction}
      registerDelayCancellable (IOSim impl):   FAIL
        *** Failed! Timeout of 1000 microseconds exceeded. (after 93 tests):
        DelayWithCancel 9223372036854.775878s Nothing
        Use --quickcheck-replay=904735 to reproduce.
        Use -p '/registerDelayCancellable (IOSim impl)/' to rerun this test only.

From this CI run.

I wasn't able to reproduce it :/.

To Reproduce Steps to reproduce the behaviour:

Expected behaviour A clear and concise description of what you expected to happen.

Desktop (please complete the following information):

coot commented 1 year ago
      registerDelayCancellable (IO impl):      FAIL
        *** Failed! Falsified (after 3 tests):
        DelayWithCancel 9223372036854.775808s Nothing
        Time 0s                    - ThreadId []   main - EventTxCommitted [] [Labelled (TVarId 0) Nothing] Nothing
        Time 0s                    - ThreadId []   main - EventUnblocked []
        Time 0s                    - ThreadId []   main - EventDeschedule Yield
        Time 0s                    - ThreadId []   main - EventThreadForked (ThreadId [1])
        Time 0s                    - ThreadId []   main - EventTxBlocked [Labelled (TVarId 0) Nothing] Nothing
        Time 0s                    - ThreadId []   main - EventDeschedule (Blocked BlockedOnSTM)
        Time 0s                    - ThreadId [1]  delay-thread - EventTimerCreated (TimeoutId 0) (TVarId 1) (Time 9223372036854.775807s)
        Time 0s                    - ThreadId [1]  delay-thread - EventTxBlocked [Labelled (TVarId 0) Nothing,Labelled (TVarId 1) (Just "<<timeout-state 0>>")] Nothing
        Time 0s                    - ThreadId [1]  delay-thread - EventDeschedule (Blocked BlockedOnSTM)
        Time 9223372036854.775807s - ThreadId [-1] timer - EventTimerFired (TimeoutId 0)
        Time 9223372036854.775807s - ThreadId [1]  delay-thread - EventTxWakeup [Labelled (TVarId 1) (Just "<<timeout-state 0>>")]
        Time 9223372036854.775807s - ThreadId [1]  delay-thread - EventTxCommitted [] [] Nothing
        Time 9223372036854.775807s - ThreadId [1]  delay-thread - EventUnblocked []
        Time 9223372036854.775807s - ThreadId [1]  delay-thread - EventDeschedule Yield
        Time 9223372036854.775807s - ThreadId [1]  delay-thread - EventTimerCreated (TimeoutId 1) (TVarId 2) (Time 9223372036854.775808s)
        Time 9223372036854.775807s - ThreadId [1]  delay-thread - EventTxBlocked [Labelled (TVarId 0) Nothing,Labelled (TVarId 2) (Just "<<timeout-state 1>>")] Nothing
        Time 9223372036854.775807s - ThreadId [1]  delay-thread - EventDeschedule (Blocked BlockedOnSTM)
        Time 9223372036854.775808s - ThreadId [-1] timer - EventTimerFired (TimeoutId 1)
        Time 9223372036854.775808s - ThreadId [1]  delay-thread - EventTxWakeup [Labelled (TVarId 2) (Just "<<timeout-state 1>>")]
        Time 9223372036854.775808s - ThreadId [1]  delay-thread - EventTxCommitted [Labelled (TVarId 0) Nothing] [] Nothing
        Time 9223372036854.775808s - ThreadId []   main - EventTxWakeup [Labelled (TVarId 0) Nothing]
        Time 9223372036854.775808s - ThreadId [1]  delay-thread - EventUnblocked [ThreadId []]
        Time 9223372036854.775808s - ThreadId [1]  delay-thread - EventDeschedule Yield
        Time 9223372036854.775808s - ThreadId []   main - EventTxCommitted [] [] Nothing
        Time 9223372036854.775808s - ThreadId []   main - EventUnblocked []
        Time 9223372036854.775808s - ThreadId []   main - EventDeschedule Yield
        Time 9223372036854.775808s - ThreadId [1]  delay-thread - EventThreadFinished
        Time 9223372036854.775808s - ThreadId [1]  delay-thread - EventDeschedule Terminated
        Time 9223372036854.775808s - ThreadId []   main - EventThreadFinished
        MainReturn (Time 9223372036854.775808s) (Nothing,True) []
        FailureEvaluation <<timeout>>
        Use --quickcheck-replay=529584 to reproduce.
        Use -p '/registerDelayCancellable (IO impl)/' to rerun this test only.