Skip to content

Commit

Permalink
Document bug and how to reproduce it
Browse files Browse the repository at this point in the history
  • Loading branch information
edsko committed Nov 7, 2023
1 parent df8815f commit 246dd9d
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
17 changes: 17 additions & 0 deletions STMBUG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
This version of the branch demonstrates the STM bug.

To reproduce, remove the workaround from `Network.GRPC.Util.Concurrency` by defining

```haskell
atomically :: forall a. STM a -> IO a
atomically = STM.atomically
```

and then run with

```
while (cabal run test-grapesy -- -p earlyTermination3 2>log); do date; done
```

You should hit the "blocked indefinitely" very quickly (usually already on the
first run).
3 changes: 3 additions & 0 deletions src/Network/GRPC/Util/Concurrency.hs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ wrapThreadBody body = body
-- TODO: Fix this properly.
-- TODO: Is 1 guarded attempt enough..? Do we need more..? Unlimited..?
atomically :: forall a. STM a -> IO a
atomically = STM.atomically
{-
atomically stm = go 1
where
go ::
Expand All @@ -92,3 +94,4 @@ atomically stm = go 1
run :: IO a
run = STM.atomically stm
-}

0 comments on commit 246dd9d

Please sign in to comment.