jwiegley / async-pool

Other
21 stars 13 forks source link

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

Open temyurchenko opened 3 years ago

temyurchenko commented 3 years ago

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.

dminuoso commented 3 years ago

This appears to be a duplicate of #7

temyurchenko commented 3 years ago

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