diff options
author | John Hawthorn <john@hawthorn.email> | 2019-05-26 13:26:19 -0700 |
---|---|---|
committer | John Hawthorn <john@hawthorn.email> | 2019-05-27 11:07:00 -0700 |
commit | 6302e56d6c1fec048f6438d9f1ac6a8cfaed7eb9 (patch) | |
tree | 884ed6e856a1b54650673d01eeb163d96e9ae702 /activerecord/lib/active_record/explain.rb | |
parent | b55f5a3ed9134ed86993fcda3ea9b6fb2e97f09e (diff) | |
download | rails-6302e56d6c1fec048f6438d9f1ac6a8cfaed7eb9.tar.gz rails-6302e56d6c1fec048f6438d9f1ac6a8cfaed7eb9.tar.bz2 rails-6302e56d6c1fec048f6438d9f1ac6a8cfaed7eb9.zip |
Use WeakRef to avoid leaking connection pools
Prior to 3e2e8eeb9ea552bd4782538cf9348455f3d0e14a the Reaper thread
would hold a reference to connection pools indefinitely, preventing the
connection pool from being garbage collected, and also leaking the
Thread.
Since 3e2e8eeb9ea552bd4782538cf9348455f3d0e14a, there is only one Reaper
Thread for all pools, however all pools are still stored in a class
variable, preventing them from being garbage collected.
This commit instead holds reference to the pools through a WeakRef. This
way, connection pools referenced elsewhere will be reaped, any others
will be able to be garbage collected.
I don't love resorting to WeakRef to solve this, but I believe it's the
simplest way to accomplish the the desired behaviour.
Diffstat (limited to 'activerecord/lib/active_record/explain.rb')
0 files changed, 0 insertions, 0 deletions