Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PG::UnableToSend: SSL SYSCALL error: EOF detected #746

Closed
mrbrdo opened this issue Dec 16, 2013 · 4 comments
Closed

PG::UnableToSend: SSL SYSCALL error: EOF detected #746

mrbrdo opened this issue Dec 16, 2013 · 4 comments

Comments

@mrbrdo
Copy link

mrbrdo commented Dec 16, 2013

Hey,

I've been recently getting this error, after I changed from Heroku's database to self-hosted (on same machine, it's a very low traffic site atm). FYI I am running sidekiq as well, and no ActiveRecord (its railtie is not loaded).

While trying to figure this out I stumbed on an issue in ActiveRecord:
rails/rails#12867

In case this gives any clue as to what may be going on. I don't really know what it could be, but it usually happens after I deploy. I am using puma and phased restart, is it possible I am missing some after fork settings for puma? Running MRI 2.0 in this case. I usually run JRuby and don't remember having this problem there (similar setup with puma).

Thank you

@jeremyevans
Copy link
Owner

Can you better describe the behavior you are getting? If it is:

  1. underlying connction drops
  2. error raised when query attempted
  3. new connection established on next query

Then Sequel is operating as designed. If however the connection is not recognized as a disconnect, and you continually receive the error every time you try to issue a query, then that is an issue.

You should post the error class that Sequel used when wrapping the exception. If it is Sequel::DatabaseDisconnectError, then there is no problem. If it is just Sequel::DatabaseError, then that is a problem.

@mrbrdo
Copy link
Author

mrbrdo commented Dec 17, 2013

Sorry about that, yes it is a Sequel::DatabaseDisconnectError. It seems to happen on the first requests I do to my web app after I phased-restart puma (the app server), and the requests fail. However on subsequent requests it seems the connection is re-established automatically and there are no more problems. Since I am on MRI in this case I am wondering if I am missing some settings for puma.

For example this is what they recommend when using ActiveRecord:

on_worker_boot do
  ActiveSupport.on_load(:active_record) do
    ActiveRecord::Base.establish_connection
  end
end

I don't think I had this problem when running on JRuby.

@jeremyevans
Copy link
Owner

As mentioned in the documentation (http://sequel.jeremyevans.net/rdoc/files/doc/code_order_rdoc.html), if you are using a preforking web server, you need to disconnect before fork. I know unicorn offers a before_fork hook, I'm not sure if puma does. If not, you just need to disconnect after your app loads.

As this is expected Sequel behavior, I'm closing this issue.

@mrbrdo
Copy link
Author

mrbrdo commented Dec 17, 2013

Thanks for the clarification!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants