Heroku - 一直崩溃

use*_*521 5 heroku

我正在 Heroku 上开发 node.js 应用程序。现在它在单个(免费)dyno 上运行。

出于某种原因,我的应用程序突然崩溃了,现在它一直崩溃(我在添加 NewRelic 和 Librato 插件后观察到它 - 添加这些插件时应用程序有点重新启动) - 应用程序在添加这些插件后第一次崩溃。所以我删除了两个插件,但问题仍然存在。我想检查一下出了什么问题,我评论了我的应用程序代码,并用网络上的简单示例替换了它:

索引.js

var http = require('http');
http.createServer(function (req, res) {
   res.writeHead(200, {'Content-Type': 'text/plain'});
   res.end('Hello World\n');
}).listen(process.env.PORT);
console.log('Server running at http://127.0.0.1:1337/');
Run Code Online (Sandbox Code Playgroud)

配置文件

web: node index.js
Run Code Online (Sandbox Code Playgroud)

package.json 中的引擎(heroku 安装的节点是 0.10.26)

"engines": {
   "node": "0.10.x"
},
Run Code Online (Sandbox Code Playgroud)

此代码适用于我的电脑(经工头测试)。当我尝试将它部署到 heroku 应用程序时崩溃 - 这是日志:

2014-04-25T09:43:42+00:00 heroku[slug-compiler]: Slug compilation started
2014-04-25T09:43:47.850609+00:00 heroku[api]: Release v30 created by xxx
2014-04-25T09:43:47.850538+00:00 heroku[api]: Deploy 562babb by xxx
2014-04-25T09:43:47+00:00 heroku[slug-compiler]: Slug compilation finished
2014-04-25T09:43:48.588089+00:00 heroku[web.1]: State changed from crashed to starting
2014-04-25T09:43:55.655057+00:00 heroku[web.1]: Starting process with command `node index.js`
2014-04-25T09:43:57.931274+00:00 heroku[web.1]: Process exited with status 8
2014-04-25T09:43:57.945393+00:00 heroku[web.1]: State changed from starting to crashed
Run Code Online (Sandbox Code Playgroud)

当我尝试heroku restart

2014-04-25T09:44:43.071357+00:00 heroku[web.1]: State changed from crashed to starting
2014-04-25T09:44:51.834860+00:00 heroku[web.1]: Starting process with command `node index.js`
2014-04-25T09:44:54.250631+00:00 heroku[web.1]: State changed from starting to crashed
2014-04-25T09:44:54.235545+00:00 heroku[web.1]: Process exited with status 8
Run Code Online (Sandbox Code Playgroud)

这让我发疯了——我向 heroku 部署了许多节点应用程序,这些应用程序在生产中运行并且从来没有出现过这样的问题——这是怎么回事???


当我将节点引擎版本更改为0.10.20(我正在使用此 v localy)时,应用程序启动并正在运行,但是当我这样做时heroku restart它又崩溃了......

State changed from up to starting
2014-04-25T10:10:12.990317+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2014-04-25T10:10:15.145758+00:00 heroku[web.1]: Process exited with status 143
2014-04-25T10:10:16.151380+00:00 heroku[web.1]: Starting process with command `node index.js`
2014-04-25T10:10:18.905637+00:00 heroku[web.1]: Process exited with status 8
2014-04-25T10:10:18.929730+00:00 heroku[web.1]: State changed from starting to crashed
Run Code Online (Sandbox Code Playgroud)

在第二次重新启动应用程序up并再次运行后,在第三次重新启动后它再次崩溃(它总是以状态 8 崩溃/退出)。

小智 6

问题可能出在 Heroku 本身。大约一个小时前创建了一份事件报告,但仍不清楚导致问题的原因: https: //status.heroku.com/incidents/614

同时,您可能想通过 HerokuDashboard 回滚到应用程序之前的工作版本。