dphg63476 2015-09-08 16:39
浏览 59
已采纳

Heroku Go应用程序崩溃

Following this tutorial, everything works locally. After I deploy my app to Heroku and visit the app on the browser I get a 503 Error and the message:

Application Error An error occurred in the application and your page could not be served. Please try again in a few moments. If you are the application owner, check your logs for details.

The logs say:

2015-09-08T16:31:53.976824+00:00 heroku[web.1]: State changed from crashed to starting
2015-09-08T16:31:56.174376+00:00 heroku[web.1]: Starting process with command `mywebsite`
2015-09-08T16:31:59.312461+00:00 app[web.1]: Listening on port: 39461
2015-09-08T16:32:56.471550+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-09-08T16:32:56.471550+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-09-08T16:32:57.390752+00:00 heroku[web.1]: Process exited with status 137
2015-09-08T16:32:57.404208+00:00 heroku[web.1]: State changed from starting to crashed
2015-09-08T16:32:57.645135+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=boiling-eyrie-6897.herokuapp.com request_id=ec26... fwd="xx.xxx.xxx.xxx" dyno= connect= service= status=503 bytes=
2015-09-08T16:32:58.233774+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=boiling-eyrie-6897.herokuapp.com request_id=ef40...fwd="xx.xxx.xxx.xxx" dyno= connect= service= status=503 bytes=

I understand what the errors are, but how can such a tiny tutorial app be causing a boot timeout (R10)?

How can I debug this better and fix the app so it runs?

  • 写回答

2条回答 默认 最新

  • doucuoyan0426 2015-09-10 15:31
    关注

    Your app needs to listen to all network connections. If it only listens on localhost, heroku's process watcher will not be able to detect that you bound the port, nor send requests to your app.

    That means instead of:

    http.ListenAndServe("127.0.0.1:"+port, nil)
    

    You need to call:

    http.ListenAndServe(":"+port, nil)
    

    See also the heroku getting started with Go app: https://github.com/heroku/go-getting-started/blob/master/cmd/go-getting-started/main.go#L27

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥50 导入文件到网吧的电脑并且在重启之后不会被恢复
  • ¥15 (希望可以解决问题)ma和mb文件无法正常打开,打开后是空白,但是有正常内存占用,但可以在打开Maya应用程序后打开场景ma和mb格式。
  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能