Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails 导致ActiveRecord::StatementInvalid:PG::Error:SSL系统调用错误:检测到EOF_Ruby On Rails_Heroku_Resque_Unicorn - Fatal编程技术网

Ruby on rails 导致ActiveRecord::StatementInvalid:PG::Error:SSL系统调用错误:检测到EOF

Ruby on rails 导致ActiveRecord::StatementInvalid:PG::Error:SSL系统调用错误:检测到EOF,ruby-on-rails,heroku,resque,unicorn,Ruby On Rails,Heroku,Resque,Unicorn,我现在在两个应用程序上遇到了这个问题。赫罗库自己也没能帮上什么忙 我正在使用: 轨道3.2.9 Heroku,拥有Postgres Dev(免费)数据库和OpenRedis Micro MongoDB(用于存储社交网络状态) 使用本地Postgres和Redis数据库运行时,一切都很好 下面是我的Heroku日志中的错误示例: 2013-01-01T21:17:27+00:00 app[resque_worker.1]: Found job on #<Resque::Queue:

我现在在两个应用程序上遇到了这个问题。赫罗库自己也没能帮上什么忙

我正在使用:

  • 轨道3.2.9
  • Heroku,拥有Postgres Dev(免费)数据库和OpenRedis Micro
  • MongoDB(用于存储社交网络状态)
使用本地Postgres和Redis数据库运行时,一切都很好

下面是我的Heroku日志中的错误示例:

2013-01-01T21:17:27+00:00 app[resque_worker.1]: Found job on #<Resque::Queue:0x00000006652920>
2013-01-01T21:17:27+00:00 app[resque_worker.1]: got: (Job{facebook} | FacebookRefresh | ["facebook_key"])
2013-01-01T21:17:27+00:00 app[resque_worker.1]: Running before_fork hooks with [(Job{facebook} | FacebookRefresh | ["facebook_key"])]
2013-01-01T21:17:27+00:00 app[resque_worker.1]: Running after_fork hooks with [(Job{facebook} | FacebookRefresh | ["facebook_key"])]
2013-01-01T21:17:27+00:00 app[resque_worker.1]: resque-2.0.0.pre.1: Processing facebook since 1357075047
2013-01-01T21:17:27+00:00 app[resque_worker.1]: resque-2.0.0.pre.1: Forked 503 at 1357075047
2013-01-01T21:17:27+00:00 app[resque_worker.1]: Running before_perform hooks with [(Job{facebook} | FacebookRefresh | ["facebook_key"])]
2013-01-01T21:17:27+00:00 app[resque_worker.1]: :             SELECT a.attname, format_type(a.atttypid, a.atttypmod),
2013-01-01T21:17:27+00:00 app[resque_worker.1]:               FROM pg_attribute a LEFT JOIN pg_attrdef d
2013-01-01T21:17:27+00:00 app[resque_worker.1]:                 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2013-01-01T21:17:27+00:00 app[resque_worker.1]:                      pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
2013-01-01T21:17:27+00:00 app[resque_worker.1]: ). Retrying...
2013-01-01T21:17:27+00:00 app[resque_worker.1]: Performing FacebookRefresh caused an exception (PG::Error: SSL SYSCALL error: EOF detected
2013-01-01T21:17:27+00:00 app[resque_worker.1]:              WHERE a.attrelid = '"facebook_accounts"'::regclass
2013-01-01T21:17:27+00:00 app[resque_worker.1]:              ORDER BY a.attnum
2013-01-01T21:17:27
+00:00 app[resque_worker.1]:                AND a.attnum > 0 AND NOT a.attisdropped
2013-01-01T21:17:27+00:00 app[resque_worker.1]: :             SELECT a.attname, format_type(a.atttypid, a.atttypmod),
2013-01-01T21:17:27+00:00 app[resque_worker.1]:               FROM pg_attribute a LEFT JOIN pg_attrdef d
2013-01-01T21:17:27+00:00 app[resque_worker.1]:                 ON a.attrelid = d.adrelid AND a.attnum = d.adnum
2013-01-01T21:17:27+00:00 app[resque_worker.1]: (Job{facebook} | FacebookRefresh | ["facebook_key"]) failed: #<ActiveRecord::StatementInvalid: PG::Error: SSL SYSCALL error: EOF detected
2013-01-01T21:17:27+00:00 app[resque_worker.1]: >
2013-01-01T21:17:27+00:00 app[resque_worker.1]:                      pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod
2013-01-01T21:17:27+00:00 app[resque_worker.1]:                AND a.attnum > 0 AND NOT a.attisdropped
2013-01-01T21:17:27+00:00 app[resque_worker.1]:              WHERE a.attrelid = '"facebook_accounts"'::regclass
2013-01-01T21:17:27+00:00 app[resque_worker.1]:              ORDER BY a.attnum
2013-01-01T21:17:27+00:00 app[resque_worker.1]: Running before_fork hooks with [(Job{facebook} | FacebookRefresh | ["facebook_key"])]
还有我的程序文件

web: bundle exec unicorn -c lib/unicorn/config.rb -p $PORT
resque_scheduler: env bundle exec rake resque:scheduler
resque_worker: env QUEUE=* bundle exec rake environment resque:work
所以我想知道的一件事是,我的resque_worker根本不使用Unicorn配置,而且由于它运行在一个完全独立的Heroku worker上,我不确定它是否有办法知道这些东西。web Instance很好,调度程序也很好。每一个博士后的电话都会引起轰动

我没有从工作人员那里打任何特别疯狂的数据库电话。这方面的一个例子可能是:

def queue_users_for_refresh
  FacebookAccount.all.each do |x|
    Resque.enqueue(FacebookAccountRefresh, x.username)
  end
end
稍后还有一个(在FacebookAccountRefresh中),即:

FacebookAccount.where(:username => user).first

这看起来像是由于不正确地跨进程共享数据库连接而导致的错误。当Resque worker在分叉后没有重新初始化数据库连接时,就会发生这种情况

你有一个Resque初始化器吗?看起来您在为Resque workers提供fork指令以匹配您的Unicorn应用程序服务器workers中的指令后丢失了

添加/编辑Resque初始值设定项文件(即:config/initializers/Resque.rb):


这看起来像是由于不正确地跨进程共享数据库连接而导致的错误。当Resque worker在分叉后没有重新初始化数据库连接时,就会发生这种情况

你有一个Resque初始化器吗?看起来您在为Resque workers提供fork指令以匹配您的Unicorn应用程序服务器workers中的指令后丢失了

添加/编辑Resque初始值设定项文件(即:config/initializers/Resque.rb):


@tibbion resque与独角兽ASFAIK resque运行vai rake任务有什么关系environment@tibbionresque与Unicorn ASFAIK resque运行vai rake任务有什么关系?它将拥有自己的环境monogid或mongodb是否有其他方式。monogid或mongodb是否有其他方式。
FacebookAccount.where(:username => user).first
Resque.after_fork = Proc.new { ActiveRecord::Base.establish_connection }