Hi,
Since 1-2 weeks I get a lot of “PGError: server closed the connection
unexpectedly” errors and I cant figure out where it is coming from.
Haven’t found any solution on Google either.
My setup is:
Postgres
Rails 2.3.9
Passenger
Ruby 1.9.2
Thought it might be passenger, so I stopped the spawning, it seems to
have helped a bit, but I still get these errors.
The errors are from random queries, so can’t really limit it to a
controller or model either.
Is the postgres server running on the same machine? or is a remote
server?. It could be a timing out problem. OR, are you using a fork
method in some place, maybe the app is missing the db connection. I
think I had same error message some time ago and if I remember well I
updated the pg-ruby binding and it worked.
Is the postgres server running on the same machine? or is a remote
server?. It could be a timing out problem. OR, are you using a fork
method in some place, maybe the app is missing the db connection. I
think I had same error message some time ago and if I remember well I
updated the pg-ruby binding and it worked.
I read about the forking problem, but I am using a plain rails stack, so
not forking anything really.
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.
I read your post somewhere and already tried to turn ssl off. My db is
on the same server currently.
I will turned it off in Postgres explicitly and will add the yml flag to
database.yml as another try.
Jim M. wrote in post #1018382:
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.
I found the problem now. It was actually nothing related to either
Ruby/Rails or Postgres, but to Ubuntu.
Wouldn’t have thought that, but it seems there was a big bug with the
glibc library that caused the Postgres connections to crash.
postgres[8194]: segfault at 0 ip b6eb5e11 sp bfb3e41c error 4 in
libc-2.11.1.so[b6e40000+157000]
looked much too late into /var/log/messages to see the error. Seems to
have been a common error on Ubuntu 10.04 LTS!! Lot of people are
affected by it in various applications.
An upgrade to a later kernel release seems to have fixed the problem.
already thought I have to switch to another release.
hope this helps people having the same problem
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.