diff --git a/STMBUG.md b/STMBUG.md new file mode 100644 index 00000000..7ff8e52a --- /dev/null +++ b/STMBUG.md @@ -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). diff --git a/src/Network/GRPC/Util/Concurrency.hs b/src/Network/GRPC/Util/Concurrency.hs index 55ab1505..981f3729 100644 --- a/src/Network/GRPC/Util/Concurrency.hs +++ b/src/Network/GRPC/Util/Concurrency.hs @@ -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 :: @@ -92,3 +94,4 @@ atomically stm = go 1 run :: IO a run = STM.atomically stm +-} \ No newline at end of file