【发布时间】:2020-05-27 04:27:05
【问题描述】:
这是我第一次将应用部署到 Heroku。我在 Python 中构建了一个 Dash 应用程序,该应用程序在 localhost 中运行良好,并且我能够按照 Dash 教程在 Heroku 上成功构建和部署它,尽管当我尝试启动它时应用程序没有加载(而是在日志中产生错误)。
我使用的是 Windows 机器,还必须添加和使用此自定义构建包([位于此处][1])才能使用 Git LFS,因为我的一个数据文件太大而无法放入 Git 存储库。
我创建了一个Procfile:
web: gunicorn app:server
并将 gunicorn 安装/添加到 requirements.txt
我在构建成功完成后尝试启动应用程序时遇到这些应用程序错误。
2020-05-27T03:43:30.000000+00:00 app[api]: Build succeeded
2020-05-27T03:50:00.231102+00:00 heroku[web.1]: State changed from crashed to starting
2020-05-27T03:50:30.788014+00:00 heroku[web.1]: Starting process with command `gunicorn app:server`
2020-05-27T03:50:34.709044+00:00 app[web.1]: [2020-05-27 03:50:34 +0000] [4] [INFO] Starting gunicorn 20.0.4
2020-05-27T03:50:34.710044+00:00 app[web.1]: [2020-05-27 03:50:34 +0000] [4] [INFO] Listening at: http://0.0.0.0:37455 (4)
2020-05-27T03:50:34.710172+00:00 app[web.1]: [2020-05-27 03:50:34 +0000] [4] [INFO] Using worker: sync
2020-05-27T03:50:34.715383+00:00 app[web.1]: [2020-05-27 03:50:34 +0000] [10] [INFO] Booting worker with pid: 10
2020-05-27T03:50:34.720666+00:00 app[web.1]: [2020-05-27 03:50:34 +0000] [11] [INFO] Booting worker with pid: 11
2020-05-27T03:50:35.355566+00:00 heroku[web.1]: State changed from starting to up
2020-05-27T03:50:56.465384+00:00 heroku[web.1]: Process running mem=1280M(250.0%)
2020-05-27T03:50:56.493628+00:00 heroku[web.1]: Error R15 (Memory quota vastly exceeded)
2020-05-27T03:50:56.496502+00:00 heroku[web.1]: Stopping process with SIGKILL
2020-05-27T03:50:56.653528+00:00 heroku[web.1]: Process exited with status 137
2020-05-27T03:50:56.689016+00:00 heroku[web.1]: State changed from up to crashed
2020-05-27T03:50:56.575446+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/" host=####.herokuapp.com request_id=56fd4ef7-74a1-4142-9637
-e76cb6a078f6 fwd="155.33.132.49" dyno=web.1 connect=0ms service=19725ms status=503 bytes=0 protocol=https
2020-05-27T03:51:01.934855+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=####.herokuapp.com request_id=1c984ec2-5f22-4620-b3c5-34957d287d0
f fwd="155.33.132.49" dyno=web.1 connect=5000ms service= status=503 bytes= protocol=https
我无法理解日志的输出,所以对于要排除故障或尝试的事情感到很困惑。
【问题讨论】:
-
您使用了多少内存?从日志来看,您请求的请求似乎超出了您的 Heroku 帐户所允许的范围,这导致您的应用程序被停止。
-
我不确定如何轻松检查内存消耗,但我通过执行一些优化并摆脱了占用大量 slug 空间的 Git LFS 构建包来解决。
标签: python heroku gunicorn plotly-dash git-lfs