2014-07-15 101 views
3

當我在本地使用thin和ssl(thin start --ssl)在我的應用程序上工作時,每5/10次請求隨機獲取此錯誤消息。PG :: ConnectionBad:PQconsumeInput()SSL錯誤:內部錯誤

PG::ConnectionBad: PQconsumeInput() SSL error: internal error 

通常我重新啓動了查詢,並將其順利,但它是一個痛苦不必刷新並正在不斷受到這種不理解的錯誤所中斷。

以下是完整的堆棧跟蹤:

PG::ConnectionBad: PQconsumeInput() SSL error: internal error 
: SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1 
Completed 500 Internal Server Error in 3.6ms 

ActiveRecord::StatementInvalid - PG::ConnectionBad: PQconsumeInput() SSL error: internal error 
: SELECT "users".* FROM "users" WHERE "users"."id" = 1 LIMIT 1: 
    activerecord (3.2.18) lib/active_record/connection_adapters/abstract_adapter.rb:285:in `rescue in log' 
    activerecord (3.2.18) lib/active_record/connection_adapters/abstract_adapter.rb:275:in `log' 
    activerecord (3.2.18) lib/active_record/connection_adapters/postgresql_adapter.rb:659:in `exec_query' 
    activerecord (3.2.18) lib/active_record/connection_adapters/postgresql_adapter.rb:1262:in `select' 
    activerecord (3.2.18) lib/active_record/connection_adapters/abstract/database_statements.rb:18:in `select_all' 
    activerecord (3.2.18) lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `block in select_all' 
    activerecord (3.2.18) lib/active_record/connection_adapters/abstract/query_cache.rb:75:in `cache_sql' 
    activerecord (3.2.18) lib/active_record/connection_adapters/abstract/query_cache.rb:61:in `select_all' 
    activerecord (3.2.18) lib/active_record/querying.rb:38:in `block in find_by_sql' 
    activerecord (3.2.18) lib/active_record/explain.rb:41:in `logging_query_plan' 
    activerecord (3.2.18) lib/active_record/querying.rb:37:in `find_by_sql' 
    activerecord (3.2.18) lib/active_record/relation.rb:171:in `exec_queries' 
    activerecord (3.2.18) lib/active_record/relation.rb:160:in `block in to_a' 
    activerecord (3.2.18) lib/active_record/explain.rb:34:in `logging_query_plan' 
    activerecord (3.2.18) lib/active_record/relation.rb:159:in `to_a' 
    bullet (4.9.0) lib/bullet/active_record3x.rb:10:in `to_a' 
    activerecord (3.2.18) lib/active_record/relation/finder_methods.rb:381:in `find_first' 
    activerecord (3.2.18) lib/active_record/relation/finder_methods.rb:122:in `first' 
    orm_adapter (0.5.0) lib/orm_adapter/adapters/active_record.rb:17:in `get' 
    devise (3.2.4) lib/devise/models/authenticatable.rb:208:in `serialize_from_session' 
    devise (3.2.4) lib/devise.rb:462:in `block (2 levels) in configure_warden!' 
    warden (1.2.3) lib/warden/session_serializer.rb:34:in `fetch' 
    warden (1.2.3) lib/warden/proxy.rb:212:in `user' 
    warden (1.2.3) lib/warden/proxy.rb:318:in `_perform_authentication' 
    warden (1.2.3) lib/warden/proxy.rb:104:in `authenticate' 
    devise (3.2.4) lib/devise/controllers/helpers.rb:58:in `current_copasser' 
    devise (3.2.4) lib/devise/controllers/helpers.rb:54:in `copasser_signed_in?' 
    app/controllers/application_controller.rb:62:in `init_current_user' 
    activesupport (3.2.18) lib/active_support/callbacks.rb:418:in `_run__685085315745422875__process_action__3032562076037965401__callbacks' 
    activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `__run_callback' 
    activesupport (3.2.18) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks' 
    activesupport (3.2.18) lib/active_support/callbacks.rb:81:in `run_callbacks' 
    actionpack (3.2.18) lib/abstract_controller/callbacks.rb:17:in `process_action' 
    actionpack (3.2.18) lib/action_controller/metal/rescue.rb:29:in `process_action' 
    actionpack (3.2.18) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action' 
    activesupport (3.2.18) lib/active_support/notifications.rb:123:in `block in instrument' 
    activesupport (3.2.18) lib/active_support/notifications/instrumenter.rb:20:in `instrument' 
    activesupport (3.2.18) lib/active_support/notifications.rb:123:in `instrument' 
    actionpack (3.2.18) lib/action_controller/metal/instrumentation.rb:29:in `process_action' 
    actionpack (3.2.18) lib/action_controller/metal/params_wrapper.rb:207:in `process_action' 
    activerecord (3.2.18) lib/active_record/railties/controller_runtime.rb:18:in `process_action' 
    actionpack (3.2.18) lib/abstract_controller/base.rb:121:in `process' 
    actionpack (3.2.18) lib/abstract_controller/rendering.rb:45:in `process' 
    actionpack (3.2.18) lib/action_controller/metal.rb:203:in `dispatch' 
    actionpack (3.2.18) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch' 
    actionpack (3.2.18) lib/action_controller/metal.rb:246:in `block in action' 
    actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:73:in `dispatch' 
    actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:36:in `call' 
    journey (1.0.4) lib/journey/router.rb:68:in `block in call' 
    journey (1.0.4) lib/journey/router.rb:56:in `call' 
    actionpack (3.2.18) lib/action_dispatch/routing/route_set.rb:608:in `call' 
    omniauth (1.2.1) lib/omniauth/strategy.rb:186:in `call!' 
    omniauth (1.2.1) lib/omniauth/strategy.rb:164:in `call' 
    omniauth (1.2.1) lib/omniauth/strategy.rb:186:in `call!' 
    omniauth (1.2.1) lib/omniauth/strategy.rb:164:in `call' 
    omniauth (1.2.1) lib/omniauth/strategy.rb:186:in `call!' 
    omniauth (1.2.1) lib/omniauth/strategy.rb:164:in `call' 
    omniauth (1.2.1) lib/omniauth/strategy.rb:186:in `call!' 
    omniauth (1.2.1) lib/omniauth/strategy.rb:164:in `call' 
    omniauth (1.2.1) lib/omniauth/builder.rb:59:in `call' 
    bullet (4.9.0) lib/bullet/rack.rb:12:in `call' 
    warden (1.2.3) lib/warden/manager.rb:35:in `block in call' 
    warden (1.2.3) lib/warden/manager.rb:34:in `call' 
    actionpack (3.2.18) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call' 
    rack (1.4.5) lib/rack/etag.rb:23:in `call' 
    rack (1.4.5) lib/rack/conditionalget.rb:25:in `call' 
    actionpack (3.2.18) lib/action_dispatch/middleware/head.rb:14:in `call' 
    actionpack (3.2.18) lib/action_dispatch/middleware/params_parser.rb:21:in `call' 
    actionpack (3.2.18) lib/action_dispatch/middleware/flash.rb:242:in `call' 
    rack (1.4.5) lib/rack/session/abstract/id.rb:210:in `context' 
    rack (1.4.5) lib/rack/session/abstract/id.rb:205:in `call' 
    actionpack (3.2.18) lib/action_dispatch/middleware/cookies.rb:341:in `call' 
    activerecord (3.2.18) lib/active_record/query_cache.rb:64:in `call' 
    activerecord (3.2.18) lib/active_record/connection_adapters/abstract/connection_pool.rb:479:in `call' 
    actionpack (3.2.18) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call' 
    activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `_run__2485068248532510814__call__1362848814740728564__callbacks' 
    activesupport (3.2.18) lib/active_support/callbacks.rb:405:in `__run_callback' 
    activesupport (3.2.18) lib/active_support/callbacks.rb:385:in `_run_call_callbacks' 
    activesupport (3.2.18) lib/active_support/callbacks.rb:81:in `run_callbacks' 
    actionpack (3.2.18) lib/action_dispatch/middleware/callbacks.rb:27:in `call' 
    actionpack (3.2.18) lib/action_dispatch/middleware/reloader.rb:65:in `call' 
    actionpack (3.2.18) lib/action_dispatch/middleware/remote_ip.rb:31:in `call' 
    better_errors (1.1.0) lib/better_errors/middleware.rb:84:in `protected_app_call' 
    better_errors (1.1.0) lib/better_errors/middleware.rb:79:in `better_errors_call' 
    better_errors (1.1.0) lib/better_errors/middleware.rb:56:in `call' 
    actionpack (3.2.18) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call' 
    actionpack (3.2.18) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call' 
    railties (3.2.18) lib/rails/rack/logger.rb:32:in `call_app' 
    railties (3.2.18) lib/rails/rack/logger.rb:18:in `call' 
    config/initializers/quiet_assets.rb:7:in `call_with_quiet_assets' 
    actionpack (3.2.18) lib/action_dispatch/middleware/request_id.rb:22:in `call' 
    rack (1.4.5) lib/rack/methodoverride.rb:21:in `call' 
    rack (1.4.5) lib/rack/runtime.rb:17:in `call' 
    activesupport (3.2.18) lib/active_support/cache/strategy/local_cache.rb:72:in `call' 
    rack (1.4.5) lib/rack/lock.rb:15:in `call' 
    actionpack (3.2.18) lib/action_dispatch/middleware/static.rb:63:in `call' 
    font_assets (0.1.11) lib/font_assets/middleware.rb:29:in `call' 
    rack-ssl (1.3.4) lib/rack/ssl.rb:27:in `call' 
    railties (3.2.18) lib/rails/engine.rb:484:in `call' 
    railties (3.2.18) lib/rails/application.rb:231:in `call' 
    railties (3.2.18) lib/rails/railtie/configurable.rb:30:in `method_missing' 
    thin (1.6.2) lib/thin/connection.rb:86:in `block in pre_process' 
    thin (1.6.2) lib/thin/connection.rb:84:in `pre_process' 
    thin (1.6.2) lib/thin/connection.rb:53:in `process' 
    thin (1.6.2) lib/thin/connection.rb:39:in `receive_data' 
    eventmachine (1.0.3) lib/eventmachine.rb:187:in `run' 
    thin (1.6.2) lib/thin/backends/base.rb:73:in `start' 
    thin (1.6.2) lib/thin/server.rb:162:in `start' 
    thin (1.6.2) lib/thin/controllers/controller.rb:87:in `start' 
    thin (1.6.2) lib/thin/runner.rb:199:in `run_command' 
    thin (1.6.2) lib/thin/runner.rb:155:in `run!' 
    thin (1.6.2) bin/thin:6:in `<top (required)>' 
    () home/augustin/.rvm/gems/ruby-1.9.3-p545/bin/thin:23:in `<main>' 
    () home/augustin/.rvm/gems/ruby-1.9.3-p545/bin/ruby_executable_hooks:15:in `<main>' 
    () home/augustin/.rvm/gems/ruby-1.9.3-p545/bin/ruby_executable_hooks:0:in `<main>' 

,我發現這個issue但它仍然沒有解決。

任何線索我應該做什麼?

感謝上帝,它不會在生產中發生,甚至不會發生,只在本地發生。

我使用:

thin --version 
thin 1.6.2 codename Doc Brown 
rails --version 
Rails 3.2.18 
ruby --version 
ruby 1.9.3p545 (2014-02-24 revision 45159) [x86_64-linux] 
psql --version 
psql (PostgreSQL) 9.1.13 

在此先感謝今天

+0

我有類似的問題。看[Stack 33112155](http://stackoverflow.com/questions/33112155/pgconnectionbad-pqconsumeinput-ssl-error-key-values-mismatch) –

回答

0

現在我已經有幾個星期了同樣的問題,走出了一條預感的我加了pool: 1到相關我的config/database.yml部分,現在錯誤似乎已消失。

基本上都是要求rails不要做連接池我在這種情況下。

development: adapter: postgresql host: ec2-54-83-14-68.compute-1.amazonaws.com username: rxeabczdnbhabc password: hiddenZFYd1Mv-abEE9jhidden database: d93f8pheuqtni3 pool: 1

+0

不錯!我需要嘗試一下,但它會很棒! –