I agree it looks like it may be a pg problem not handling a
disconnection from the database and going into an infinite loop.

However I suspected Sequel as the two other Rails apps running on the
same machine under the same passenger but using ActiveRecord do not
exhibit this problem, event though they also use pg. But they are an
older version of rails.

FYI since switching the Sequel connection to a Unix Pipe it has not
exhibited this error.

I suspect the reason the posgresql is loosing the connection is due to
the SSL renegotiation that is documented elsewhere.
I could check that by going back to using a TCP connection without
SSL. Although I'm not sure how to tell it to not use SSL other than
restarting pgsql wioth ssl turned off.

On Dec 19, 11:12 am, Jeremy Evans <[email protected]> wrote:
> On Dec 18, 5:11 pm, Jim Morris <[email protected]> wrote:
>
>
>
> > Hi,
>
> > I just deployed a Rails 3.0.3 app using sequel (3.17.0) as the ORM. pg
> > 0.10.0 gem as the adapter. on a Linux Ubuntu 10.04 server, I am using
> > postgresql (8.4.5) as the database.
>
> > I am seeing the occasional error in the production log...
>
> > PGError: server closed the connection unexpectedly
> >         This probably means the server terminated abnormally
> >         before or while processing the request.: SELECT COUNT(*) AS
> > "count" FROM "posts" LIMIT 1
> > Completed   in 8ms
>
> > Sequel::DatabaseDisconnectError (PGError: server closed the connection
> > unexpectedly
> >         This probably means the server terminated abnormally
> >         before or while processing the request.
> > ):
>
> > I'm not sure why I get this and the postgresql log says the client
> > disconnected. (may not be related).
>
> > I've not had flakyness issues with pgsql before and I do have 2 other
> > rails apps running on the same server but they use AcitveRecord (and
> > an older version of rails), and I don't see the equivalent errors.
>
> > Anyone else experienced these issues?
>
> > I am thinking that maybe it is an SSL issue as the default connection
> > for pgsql on Ubuntu 10.04 seems to be over SSL, so I have changed the
> > connection string to not specify host, user or password, this seems to
> > force it to use linux domain sockets, I'll see if the errors still
> > crop up, they are pretty infrequent, but I think they cause the ruby
> > process to start using 100% CPU under passenger, and strace shows it
> > is doing this continuously...
>
> > select(5, [4], NULL, NULL, NULL)        = -1 EBADF (Bad file
> > descriptor)
> > select(5, [4], NULL, NULL, NULL)        = -1 EBADF (Bad file
> > descriptor)
>
> > And if I issue an SIGABRT to that ruby process the back trace shows it
> > just did a database access...
>
> > SignalException (SIGABRT):
> >   app/models/post.rb:36:in `find_by_permalink'
> >   app/controllers/posts_controller.rb:56:in `show'
>
> > All the source code to the app is 
> > here...https://github.com/wolfmanjm/wolfmanblog_rails
>
> > Any discussion or ideas may help me track this issue down, not sure if
> > it is a rails, passenger, sequel or pgsql issue yet.
>
> This doesn't sound like a Sequel or Rails issue to me.  Could be a pg
> issue, a passenger issue, or a general ruby issue, but I'm not sure
> which.  It definitely sounds like it could be SSL related, so
> hopefully making it use a unix socket instead of an IP socket will fix
> the issue.
>
> Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to