on master help sign in
cleanup any pending threads on exception
dc7f419Harendra Kumar
Changelog.md+1
@@ -2,6 +2,7 @@
2
2
3### Bug Fixes
3### Bug Fixes
4
4
5+* Cleanup any pending threads when an exception occurs.
5* Fixed a livelock in ahead style streams. The problem manifests sometimes when
6* Fixed a livelock in ahead style streams. The problem manifests sometimes when
6 multiple streams are merged together in ahead style and one of them is a nil
7 multiple streams are merged together in ahead style and one of them is a nil
7 stream.
8 stream.
src/Streamly/Streams/SVar.hs+1−1
@@ -101,7 +101,7 @@ fromStreamVar sv = Stream $ \st stp sng yld -> do
101 case fromException ex of
101 case fromException ex of
102 Just ThreadAbort ->
102 Just ThreadAbort ->
103 unStream rest (rstState st) stp sng yld
103 unStream rest (rstState st) stp sng yld
104− Nothing -> throwM ex
104+ Nothing -> liftIO (cleanupSVar sv) >> throwM ex
105
105
106{-# INLINE fromSVar #-}
106{-# INLINE fromSVar #-}
107fromSVar :: (MonadAsync m, IsStream t) => SVar Stream m a -> t m a
107fromSVar :: (MonadAsync m, IsStream t) => SVar Stream m a -> t m a