Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

IOSimPOR fails to find a race under specific circumstances

Aperta
#183 5 commenti 2 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
haskell

Direzione di ricerca

Inizia riproducendo il caso prop_race con e senza la riga atomically $ writeTQueue tq (), usando le versioni indicate GHC 9.6.6, io-sim 1.6.0.0 e io-classes 1.7.0.0. Leggi il comportamento di exploreSimTrace e exploreRaces e confrontalo con la traccia fail.txt fornita. Il lavoro è completato quando IOSimPOR trova la race di deadlock in entrambe le varianti.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug IOSimPOR

Describe the bug
This test case:

prop_race :: Property
prop_race = exploreSimTrace id action $ \_ trace ->
  case traceResult False trace of
    Left (FailureDeadlock err) -> counterexample (ppTrace trace) $ property False
    _ -> property True
  where
    action :: IOSim s ()
    action = do
      exploreRaces
      ref <- newMVar 0
      tq <- atomically newTQueue
      let f = do
            atomically $ writeTQueue tq ()
            bracketOnError
              (takeMVar ref)
              (tryPutMVar ref)
              (putMVar ref . (+1))
      t1 <- async f
      t2 <- async f
      async (cancel t1) >>= wait
      wait t2
      wait t1

will succeed. However removing the atomically $ writeTQueue tq () will make it fail because of a Deadlock. The deadlock is indeed present in the implementation: t1 takes, t1 puts, t1 receives exception, t2 takes, t1 tryPut succesfully, t2 blocks on put.

Writing to that tqueue before running the bracketOnError results in the race not being found by IOSimPOR. This looks like a direct bug.

Desktop (please complete the following information):

  • GHC version: 9.6.6
  • io-sim version: 1.6.0.0
  • io-classes version: 1.7.0.0

Additional context
Add any other context about the problem here. Attach io-sim or io-sim-por trace if possible.

A trace with the deadlock if removing the mentioned line:
fail.txt

Lingua principale
Haskell
Stelle
57
Fork
25
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di IntersectMBO/io-sim

Tutte le issue di IntersectMBO/io-sim

Issue simili

Altre issue su Haskell

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.