Rails ConnectionTimeoutError under Puma: pool.stat shows waiting threads, but raise the pool or release connections earlier?
Symptom A Rails application running on Puma with multiple threads intermittently raises ActiveRecord::ConnectionTimeoutError ("could not obtain a database connection within 5.000 seconds") under moderate load. Sampling ActiveRecord::Base.connection_pool.stat during incidents shows busy equal to the configured pool size and waiting above zero, which points at