Heroku部署错误H10(应用程序崩溃)

167

我在本地计算机上运行了一个RoR应用程序,但是当我将其发送到Heroku时,它会崩溃。错误日志显示错误H10并显示:

    2012-11-21T15:26:47+00:00 app[web.1]:   from /app/vendor/bundle/ruby/1.9.1/gems/newrelic_rpm-3.4.2/lib/new_relic/control/instance_methods.rb:95:in `start_agent'
    2012-11-21T15:26:48+00:00 heroku[web.1]: State changed from starting to crashed
    2012-11-21T15:26:48+00:00 heroku[web.1]: Process exited with status 1
    2012-11-21T15:26:59+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:27:00+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:30:08+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:30:08+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:30:59+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:31:19+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:31:19+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:32:08+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=
    2012-11-21T15:32:08+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path=/ host=xxx.herokuapp.com fwd= dyno= queue= wait= connect= service= status=503 bytes=

编辑:

2012-11-22T10:00:58+00:00 app[web.1]: 
2012-11-22T10:00:59+00:00 heroku[router]: at=info method=GET path=/favicon.ico host=xxx.herokuapp.com fwd= dyno=web.1 queue=0 wait=0ms connect=1ms service=26ms status=200 bytes=0

有没有人遇到过这个问题,知道可能是什么原因导致的?我找不到解决方案。

谢谢。


几个月前遇到了同样的错误。刚开始使用新的HEROKU应用程序,它很有帮助。看起来你在dyno池中有一个损坏的dyno。 - Rustem
不幸的是,这并没有解决我的问题。 - bskool
尝试这个:heroku config:add BUILDPACK_URL=https://github.com/joelcogen/heroku-buildpack-rails-unicorn-nginx - ChuckJHardy
这真的很烦人。特别是因为增加日志级别以包括错误跟踪非常困难。 - max pleaner
遇到了相同的H10错误。在检查日志后,发现是whitenoise的问题,因此我想出了这个解决方案。也许对其他人也有帮助。 - Jakob
显示剩余2条评论
37个回答

2

由于主代码文件名称错误,我在Heroku和Node中遇到了H10错误。编辑package.json

{

  ...

  "main": "correct_file_name.js",

  ...

  "scripts": {
    "start": "node correct_file_name.js"
  }
}

或者重命名文件。


2
我在Heroku中遇到了同样的H10应用崩溃错误。我在Heroku界面上点击“重启所有dynos”,问题得到解决。

2
我也遇到了完全相同的问题。Rails控制台没有显示任何错误。应用程序日志中也没有错误。尝试通过命令行重启,尝试将规模缩小到0,然后再放大。但是都没有起作用。唯一有效的方法是登录Heroku并在右上角的下拉菜单中单击“重新启动所有dynos”。感谢您的帮助! - Will Tew

2
在我的情况下,我使用的Procfile破坏了一切。Heroku在启动应用程序时寻找Procfile并应用其设置 - 显然我使用的开发设置对生产服务器没有任何意义。我不得不将其重命名为Procfile.dev,然后一切都开始正常工作了。

2

对我有用的解决方案:尝试运行以下命令:

Heroku重启

输入图像描述


感谢 @paridhishah - Abdullah

1
看看你是否明白。
bash: bin/rails: No such file or directory

在运行日志时(heroku logs -t),如果出现问题,请运行该命令。
bundle exec rake rails:update

不要覆盖你的文件,在最后这个命令将会创建一个新文件。
  create  bin
  create  bin/bundle
  create  bin/rails
  create  bin/rake

将这些文件推送到Heroku,你就完成了。

1
我所面临的问题根源在于没有数据库。为了解决这个问题,我首先导出了我的本地数据库:
$ heroku addons:add heroku-postgresql:dev 
$ heroku addons:add pgbackups
$ PGPASSWORD=mypassword pg_dump -Fc --no-acl --no-owner -h localhost -U myuser mydb > mydb.dump 

然后将其导入Heroku:

$ heroku pgbackups:restore DATABASE 'http://site.tld/mydb.dump'

这些示例中要替换的变量是:mypasswordmyusermydbhttp://site.tld/mydb.dump。请注意,我必须将转储文件上传到临时服务器。
解决了所有问题后,我写了一个快速指南,介绍如何将Enki部署到Heroku,可以在这里找到

1
我遇到了与“应用程序崩溃”相同的错误,但Heroku应用程序日志没有显示与错误消息原因相关的太多信息。然后我重新启动了Heroku中的dynos,然后它显示了一个错误,说我的设置中的一个index.js文件中有额外的大括号。一旦删除并在Heroku上重新部署应用程序,问题就得到解决。 希望这对于遇到相同问题的人有所帮助。

1
我遇到了同样的问题,我做了以下操作。
heroku run rails c

它识别出控制器允许的参数中存在语法错误和逗号缺失。如上所述,Heroku日志未提供足够的信息来解决问题。

我以前在Heroku上没有看到应用程序崩溃的消息。


在我的情况下,Heroku 上出现了一个“未初始化常量”错误,而本地没有出现这个错误。虽然我仍然需要解决这个问题,但我已经成功地重新部署了一个可工作的版本。 - Steve Meisner

1
在查看了所有答案列表之后,我偶然发现了这个网站:https://status.heroku.com/ ,它详细介绍了Heroku的当前状态/故障。在碰壁之前检查一下是否有故障总是比较安全的。对于我来说,导致错误的是上述链接中发布的附加事件报告。

SERVER INCIDENT UPDATE


1
我将我的问题追溯到 Puma 服务器,Ahmed Elkoussy 也是如此,但我通过在 puma.rb 文件中注释以下行来解决问题:

# pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接