简体   繁体   English

Heroku上的恒定500错误

[英]Constant 500 Errors on Heroku

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). 我最近从Heroku的Bamboo堆栈切换到了Cedar堆栈(Rails 3.1.4,Ruby 1.9.2,用于Web服务器的Thin gem)。 Since then I keep getting 500 errors such as this, where it seems that the query is not acting right: 从那时起,我不断收到500个这样的错误,似乎查询的行为不正确:

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. 但这不是代码中的错误,因为刷新页面时页面最终成功渲染(即状态200)。 Sometimes it is 1 refresh, but can get up to 4 refreshes before I get a 200. 有时是1次刷新,但在获得200次刷新之前最多可以刷新4次。

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 我以为这是数据库,因为我处于ClearDB的免费计划中,但是我升级到ClearDB的下一个计划,具有更好的I / O性能,但它仍然会发生

  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 ? 如果您在控制台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 尝试升级您的Mysql gem,您正在使用http://api.rubyonrails.org/classes/ActiveRecord/StatementInvalid.html升级哪一个我认为正确的是mysql2 https://rubygems.org/gems/mysql2

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM