Heroku常数500错误

编程入门 行业动态 更新时间:2024-10-25 11:31:32
本文介绍了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性能计划,它仍然会发生。

  • b $ b
  • 它发生在每个查询数据库的页面上
  • 它并不总是发生,但我认为它至少发生在1/5 pages views
  • 模型/查询无关紧要,同样的错误发生(只是表示不同的模型/字段,然后是上面的例子)

    解决方案

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

  • this never happened when I was on Bamboo
  • it happens on just about every page that does queries on the DB
  • it doesn't always happen, but I'd say it happens on at least 1 in 5 pages views
  • 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 api.rubyonrails/classes/ActiveRecord/StatementInvalid.html i think the correct one is mysql2 rubygems/gems/mysql2

    更多推荐

    Heroku常数500错误

    本文发布于:2023-11-04 12:21:39,感谢您对本站的认可!
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:常数   错误   Heroku

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!