Heroku常数500错误 [英] Constant 500 Errors on Heroku

查看:127
本文介绍了Heroku常数500错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近我从Heroku的Bamboo堆栈切换到Cedar(Rails 3.1.4,Ruby 1.9.2,Web服务器的Thin Gem)。从那时起,我不断收到500个这样的错误,看起来这个查询不是正确的:

  207 13> ; 1 2012-05-06T16:10:51 + 00:00 d。应用程序web.1  -   -  ActiveRecord :: StatementInvalid(Mysql ::错误::选择`foos`。*从`foos`在哪里`foos`.`id` =?限制1)

这不是代码中的错误,因为当我刷新页面时,页面最终呈现成功(即状态200)。有时它是1次刷新,但在获得200次之前最多可刷新4次。



我认为这是数据库,因为我使用了ClearDB的免费计划,但是我升级到ClearDB的下一个更好的I / O性能计划,它仍然会发生。


  1. b $ b
  2. 它发生在每个查询数据库的页面上

  3. 它并不总是发生,但我认为它至少发生在1/5 pages views

  4. 模型/查询无关紧要,同样的错误发生(只是表示不同的模型/字段,然后是上面的例子)


解决方案

如果您位于控制台 heroku run console 中,是否会出现相同的错误?我从来没有见过这个。尝试升级您的Mysql gem,您使用的是 http://api.rubyonrails.org/ classes / ActiveRecord / StatementInvalid.html 我认为正确的是mysql2 https://rubygems.org/gems / mysql2


I recently switched from Heroku's Bamboo stack to the Cedar one (Rails 3.1.4, Ruby 1.9.2, Thin gem for web server). Since then I keep getting 500 errors such as this, where it seems that the query is not acting right:

207 <13>1 2012-05-06T16:10:51+00:00 d. app web.1 - - ActiveRecord::StatementInvalid (Mysql::Error: : SELECT  `foos`.* FROM `foos`  WHERE `foos`.`id` = ? LIMIT 1)

It's not an error in the code though because the page eventually renders successfully (ie status 200) when I refresh the page. Sometimes it is 1 refresh, but can get up to 4 refreshes before I get a 200.

I thought it was the database because I was on ClearDB's free plan, but I upgraded to ClearDB's next plan with better I/O performance and it still happens

  1. this never happened when I was on Bamboo
  2. it happens on just about every page that does queries on the DB
  3. it doesn't always happen, but I'd say it happens on at least 1 in 5 pages views
  4. the model/query doesn't matter, the same error occurs (just indicating a different model/fields then the example above)

解决方案

Do you get the same errors if you are in console heroku run console ? I've never seen this before. Try upgrading your Mysql gem, which one are you using http://api.rubyonrails.org/classes/ActiveRecord/StatementInvalid.html i think the correct one is mysql2 https://rubygems.org/gems/mysql2

这篇关于Heroku常数500错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆