Fix "thread blocked indefinitely in an MVar operation
The problem occurred because a thread was not sending a Stop message after
detecting that yield limit is over and killing all other threads.
commitf0f0c8bc141450a546957e3ccafbe8b228a374ab
authorHarendra Kumar <harendra.kumar@gmail.com>
dateFri 23 Aug 2019, 12:38 (7 years ago)
parent3336bb1
Changelog.md+2
@@ -40,6 +40,8 @@
4040### Bug Fixes
4141
4242* Fix a bug that caused `uniq` function to yield the same element twice.
43+* Fix a bug that caused "thread blocked indefinitely in an MVar operation"
44+ exception in a parallel stream.
4345
4446### Major Enhancements
4547
src/Streamly/Streams/Parallel.hs+3−1
@@ -104,7 +104,9 @@ runOneLimited st m0 winfo = go m0
104104 then do
105105 liftIO $ decrementBufferLimit sv
106106 foldStreamShared st yieldk single stop m
107− else liftIO $ cleanupSVarFromWorker sv
107+ else do
108+ liftIO $ cleanupSVarFromWorker sv
109+ liftIO $ sendStop sv winfo
108110
109111 sv = fromJust $ streamVar st
110112