gpt4 book ai didi

ruby-on-rails-3 - PG::错误:SSL SYSCALL 错误:检测到 EOF

转载 作者:行者123 更新时间:2023-12-03 22:23:13 25 4
gpt4 key购买 nike

当我对我的 RoR 应用程序执行第一个 SELECT 请求时,我得到
“PG::Error:SSL SYSCALL 错误:检测到 EOF”。
我应该怎么做才能在 Postgresql 中关闭 SSL?

错误信息:

ActiveRecord::StatementInvalid: PG::Error: SSL SYSCALL error: EOF detection : SELECT "vacancies".* FROM "vacancies"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'

最佳答案

我找到了解决这个问题的方法。如果您使用 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

关于ruby-on-rails-3 - PG::错误:SSL SYSCALL 错误:检测到 EOF,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11875180/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com