worker pools example program can deadlock #125

Open
kostya-sh opened this Issue Mar 3, 2016 · 0 comments

1 participant

@kostya-sh

The example relies on the fact that jobs and results channel buffers are big enough. If the code is changed to use smaller buffers for these channels:

jobs := make(chan int, 2)
results := make(chan int, 2)

then example program will deadlock: http://play.golang.org/p/whGg0n8qgT

Also in practice number of jobs is variable and it is hard to find the right size for the channels buffer that will work in all cases. This should at least be explained on the example page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment