Closed olalonde closed 8 years ago
thanks for reporting this... I'm not sure what's going on here but I have some guesses. I'll see if I can reproduce this locally and have a poke around,
I think the issue seems to be due to the fact that both initial calls to pool.acquire
are done in the same event loop. Not sure how exactly it is triggering this bug though.
@olalonde I've got a bit lost down the rabbit hole that was dealing with the timing/order bugs in the existing version of generic-pool. In a slight acceptance of defeat I wrote v3 to use promises instead and rewrote alot of the internal logic, and I think I've made the above situation harder to get into (or at least easier to not be in!)
v3 is still alpha but it's on npm npm install generic-pool@latest
. There are some other additions I want to make but the current API should be what finally ships (unless it's horribly broken).
Prints the following and exits:
Here's the code for initPidPool:
The expected behaviour would be for the process to hang indefinitely since max is 1 and the second call to acquire should wait forever since we are not releasing the resource.