Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PG::Error: SSL SYSCALL error: EOF detected

When i do my first SELECT requests to my RoR app i get "PG::Error: SSL SYSCALL error: EOF detected". What should i do to turn off SSL in my Postgresql?

Error info:

ActiveRecord::StatementInvalid: PG::Error: SSL SYSCALL error: EOF detected : SELECT "vacancies".* FROM "vacancies" WHERE (moderated_at IS NOT null) ORDER BY id DESC LIMIT 10

Sample stack trace (show Rails)

…ases/20120808235942/app/controllers/home_controller.rb:   6:in `index'
…le/ruby/1.9.1/gems/journey-1.0.3/lib/journey/router.rb:  68:in `block in call'
…le/ruby/1.9.1/gems/journey-1.0.3/lib/journey/router.rb:  56:in `each'
…le/ruby/1.9.1/gems/journey-1.0.3/lib/journey/router.rb:  56:in `call'
…dle/ruby/1.9.1/gems/warden-1.1.1/lib/warden/manager.rb:  35:in `block in call'
…dle/ruby/1.9.1/gems/warden-1.1.1/lib/warden/manager.rb:  34:in `catch'
…dle/ruby/1.9.1/gems/warden-1.1.1/lib/warden/manager.rb:  34:in `call'
…red/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/etag.rb:  23:in `call'
…/ruby/1.9.1/gems/rack-1.4.1/lib/rack/conditionalget.rb:  25:in `call'
…/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb: 205:in `context'
…/1.9.1/gems/rack-1.4.1/lib/rack/session/abstract/id.rb: 200:in `call'
…/ruby/1.9.1/gems/rack-1.4.1/lib/rack/methodoverride.rb:  21:in `call'
…/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/runtime.rb:  17:in `call'
…red/bundle/ruby/1.9.1/gems/rack-1.4.1/lib/rack/lock.rb:  15:in `call'
…by/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb: 136:in `forward'
…by/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb: 245:in `fetch'
…by/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb: 185:in `lookup'
…by/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:  66:in `call!'
…by/1.9.1/gems/rack-cache-1.2/lib/rack/cache/context.rb:  51:in `call'
…by/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb: 531:in `process_client'
…by/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb: 606:in `worker_loop'
…by/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb: 487:in `spawn_missing_workers'
…by/1.9.1/gems/unicorn-4.3.1/lib/unicorn/http_server.rb: 137:in `start'
like image 941
Leo Lukin Avatar asked Aug 09 '12 00:08

Leo Lukin


1 Answers

I found how to fix this problem. If you use Capistrano to deploy you app add to unicorn.rb

before_fork do |server, worker|
  defined?(ActiveRecord::Base) and
      ActiveRecord::Base.connection.disconnect!
end

after_fork do |server, worker|
   defined?(ActiveRecord::Base) and
      ActiveRecord::Base.establish_connection
end
like image 175
Leo Lukin Avatar answered Oct 14 '22 07:10

Leo Lukin