Hi All,
I’m seeing intermittent Postgres errors in my rails app that are resulting in very long-running requests. I’ve googled this error, but all the results points to a problem with an earlier version of Rails that has supposedly been fixed, or to problems with gems I’m not using (Sideqik) . This is a low-traffic application, and I can’t see any pattern as to when the errors occur.
I’m running the following:
Rails 4.2.1
pg gem 0.18.2
ruby 2.2.0
Postgres 9.1.11, with max_connections=200, current connections ~90
Ubuntu 14.04.2
Passenger 5.0.8
The error is PG::UnableToSend (SSL SYSCALL error: EOF detected)
Starting with Rails 7.1, auto-reconnect behaviour becomes standard on all database adapters, as long as it’s an idempotent query. (Details from the changelog.)
The ability to set reconnect: true in database.yml was introduced in Rails 2.3:
Some additional info about reconnecting is found in Brian Lopez’s mysql2 gem.