rails/rails — pull request #17468 by creddy (2014-10-31 21:57:55+00:00)
Title: Close database connections that fail the verify! check. More...

Hello all, looking for some feedback on this change. Thank you for reviewing!

Normally, a database connection is leased, verified, reserved, and then
returned to the pool from the list of reserved connections
(on success or failure). If an exception is thrown in the verification
step, the connection is never reserved and therefore can not be found in
the reserved list to be returned to the pool.

The verification step will fail if there are database connectivity issues
(db restart, etc.) and will not return connections. Once all the
connections are used the server will no longer accept new connections
until it is restarted.

This change ensures that the connection is checked back into the pool if a
driver exception occurs during connection.verify!. This prevents the
connection being stuck in an 'in use' state.