rails/rails — pull request #14360 by matthewd (2014-03-12 14:53:25+00:00)
Title: Track owning thread for connection pool

Now, if a thread checks out a connection then dies, we can immediately recover that connection and re-use it.

This should alleviate the pool exhaustion discussed in #12867. More importantly, it entirely avoids the potential issues of the reaper attempting to check whether connections are still active: as long as the owning thread is alive, the connection is its business alone.

/cc @tenderlove @jeremy

I kept the #reset! fix in a separate commit... it seems unrelated, apart from having been spotted while dealing with this. Let me know if it should be squashed anyway.