Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Heroku - crash all the time

Tags:

heroku

I am developing node.js app on heroku. For now it runs on single (free) dyno.

For some reason suddenly my app crashed and now it crashes all the time (I observed it after adding NewRelic and Librato addons - app is kind of restarted when adding those addons) - app crashed for the first time after one of those addons were added. So I removed both addons but problem still remained. I wanted to check whats wrong and I commented my app code and replaced it with simple example from the web:

index.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/');

Procfile

web: node index.js

engines in packages.json (node installed by heroku is 0.10.26)

"engines": {
   "node": "0.10.x"
},

This code works on my pc (tested with foreman). When I try to deploy it to heroku app crashes - here is the log:

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

when I try to 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

This make me crazy - I deployed many node apps to heroku which are runing in production and had never such problems - whats going on???


When I changed node engine version to 0.10.20 (I am using this v localy) then app started and was working but when I did heroku restart it crashed again...

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

after second restart app was up and runing again, and after third restart it crashed again (it always crashes/exits with status 8).

like image 599
user606521 Avatar asked Apr 25 '14 10:04

user606521


2 Answers

The problem could be on Heroku itself. There was an incident report created about an hour ago but it is still unclear what is causing the problem: https://status.heroku.com/incidents/614

Meanwhile, you might want to rollback to the previous working build of your app via HerokuDashboard.

like image 162
user2463690 Avatar answered Oct 29 '22 17:10

user2463690


add this config to package.json:

 "scripts": {
"start": "node index.js"},

index.js is name of of file you want to start you app from here like www.js or server.js

www.piero.ir/en

like image 22
pirooz jenabi Avatar answered Oct 29 '22 16:10

pirooz jenabi