async-pool icon indicating copy to clipboard operation
async-pool copied to clipboard

`runConcurrently` hangs whenever a number of tasks is greater than the pool capacity

Open temyurchenko opened this issue 4 years ago • 2 comments

Suppose, I have the following piece of code

import Control.Concurrent.Async.Pool (Concurrently(..), withTaskGroup)

main :: IO ()
main = do
  let xs = [1, 2, 3, 5, 6] :: [Int]
  s <- withTaskGroup 4
        (runConcurrently (sum <$> traverse (Concurrently . const . pure) xs))
  print s

It hangs whenever the pool size is lesser than the number of tasks. E.g. the code above hangs, but if we change pool size from 4 to 5, it doesn't.

temyurchenko avatar May 12 '21 19:05 temyurchenko

This appears to be a duplicate of #7

dminuoso avatar May 12 '21 20:05 dminuoso

It seems so, but #7 is closed and the underlying issue with Concurrently is not fixed.

temyurchenko avatar May 12 '21 21:05 temyurchenko