2012-08-09 113 views
6

当我对我的RoR应用程序执行第一次SELECT请求时,我得到 “PG ::错误:SSL SYSCALL错误:检测到EOF”。 我应该如何在我的Postgresql中关闭SSL?PG ::错误:SSL SYSCALL错误:检测到EOF

错误信息:

的ActiveRecord :: StatementInvalid:PG ::错误:SSL SYSCALL错误:EOF检测:选择 “空缺” * 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' 
+0

你已经看到[**这**](http://stackoverflow.com/questions/10170807/activerecordstatementinvalid-pg-error) ? – 2012-08-09 00:50:41

+0

这是一样的情况吗? – 2012-08-09 06:02:11

回答

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