PG ::错误:SSL SYSCALL错误:检测到EOF

时间:2012-08-09 00:30:19

标签: ruby-on-rails-3

当我第一次向我的RoR应用程序发出SELECT请求时,我得到了     " PG ::错误:SSL SYSCALL错误:检测到EOF"。 我该如何在Postgresql中关闭SSL?

错误信息:

ActiveRecord :: StatementInvalid:PG ::错误:SSL SYSCALL错误:检测到EOF:SELECT"空缺"。* FROM"空缺" WHERE(moderated_at IS not null)ORDER BY id DESC LIMIT 10

示例堆栈跟踪(显示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'

1 个答案:

答案 0 :(得分:2)

我找到了解决这个问题的方法。如果您使用Capistrano部署应用程序添加到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