I was getting these errors too, in my case it turned out to be the ssl connection to postgresql (on a local to local connection). Seems it uses ssl by default, and there is an issue with long running ssl connections.
Simple solution for me was to turn off SSL on the connection, as it was a local connection and going going over the internet. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/B5T1ib0GOCwJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.