mobc
mobc copied to clipboard
fix: Change from channels to use a Semaphore
When under very heavy load, the conn_requests can include to many
Sender's with dropped Receivers. When the Conn is passed to a waiting
Receiver and it was recently dropped the Conn could be lost causing
a mis-count on the num_open
stat which stops any new connections
from being created and then mobc deadlocks.
This fixes it by switching from a oneshot channel and queue to using a Semaphore to keep track of available connections for any requests.
This fixes https://github.com/importcjj/mobc/issues/63
I'll leave this PR open in case anyone else comes across this. We will be managing a forked mobc with this fix over here https://github.com/prisma/mobc
Closed based on #69