Heroku discord bot keeps restarting - heroku

So I just recently made a discord.js bot and am currently hosting it on Heroku. However I've noticed that roughly every hour my heroku application will just randomly restart, in turn causing my bot to shut off briefly and turn back on. No reason whatsoever, no errors at all. Anyone know why this is and if there's a way to stop it?
Here's a log of what it says when it restarts:
2020-12-19T08:42:47.712115+00:00 heroku[worker.1]: Cycling
2020-12-19T08:42:47.714177+00:00 heroku[worker.1]: State changed from up to starting
2020-12-19T08:42:49.171040+00:00 heroku[worker.1]: Stopping all processes with SIGTERM
2020-12-19T08:42:49.364823+00:00 heroku[worker.1]: Process exited with status 143
2020-12-19T08:42:50.597052+00:00 heroku[worker.1]: Starting process with command `node index.js`
2020-12-19T08:42:51.347038+00:00 heroku[worker.1]: State changed from starting to up
2020-12-19T08:42:53.932302+00:00 app[worker.1]: Bot started!
2020-12-20T09:18:11.938012+00:00 heroku[worker.1]: Cycling
2020-12-20T09:18:11.945355+00:00 heroku[worker.1]: State changed from up to starting
2020-12-20T09:18:14.978039+00:00 heroku[worker.1]: Starting process with command `node index.js`
2020-12-20T09:18:15.635278+00:00 heroku[worker.1]: State changed from starting to up
2020-12-20T09:18:16.613701+00:00 heroku[worker.1]: Stopping all processes with SIGTERM
2020-12-20T09:18:16.745918+00:00 heroku[worker.1]: Process exited with status 143
2020-12-20T09:18:18.344454+00:00 app[worker.1]: Bot started!

Heroku Dynos restart (cycle) every 24 hours, check the logs and you see it happens on different days.
There is nothing you can do, all Dyno types have this behaviour. One workaround is to restart the Dyno yourself (at least once a day) so you can control when this happens.

Related

State Changed from up to Crashed ( Discord App Won't Start ) , and yes i use a start script and everything is right

2022-05-27T00:41:10.751190+00:00 heroku[worker.1]: State changed from up to crashed
2022-05-27T00:41:10.761682+00:00 heroku[worker.1]: State changed from crashed to starting
2022-05-27T00:41:12.597341+00:00 heroku[worker.1]: Starting process with command : node .
2022-05-27T00:41:13.215607+00:00 heroku[worker.1]: State changed from starting to up
2022-05-27T00:41:13.579455+00:00 heroku[worker.1]: Process exited with status 0
2022-05-27T00:41:13.649880+00:00 heroku[worker.1]: State changed from up to crashed
2022-05-27T00:41:45.366307+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2022-05-27T00:41:45.457887+00:00 heroku[web.1]: Stopping process with SIGKILL
2022-05-27T00:41:45.474285+00:00 app[web.1]: Error waiting for process to terminate: No child processes
2022-05-27T00:41:45.610972+00:00 heroku[web.1]: Process exited with status 22
For python,
Simply, use gunicorn to easen the burden.
Within the project directory, with the virtual environment activated, install gunicorn as follows:
pip install gunicorn
If you're using pipenv you can try:
pipenv install gunicorn
Update the requirements.txt file to include the new installed gunicorn module by running:
pip freeze > requirements.txt
Update the Procfile as follows:
web: gunicorn your_django_project_name.wsgi --log-file -
N.B:
There should be space between the web: and gunicorn as well as between --log-file and the - next to it.
Lastly, add, commit and push the changes
For js devs,
Make sure the Procfile looks like:
web: npm start
THEN
try this solution here

Golang -- Deploy app using heroku app crashed H10

I need help...
I'm using heroku to deploy my golang app... but it seems my Procfile is not in the right format... here is the Procfile:
web: app-crm
everytime I deploy the app, it says succeeded but then after I access my endpoint, my app crashed with this message:
2021-11-15T08:00:49.813561+00:00 heroku[web.1]: State changed from crashed to starting
2021-11-15T08:00:50.113738+00:00 heroku[web.1]: Starting process with command `app-crm`
2021-11-15T08:00:51.791188+00:00 app[web.1]: bash: app-crm: command not found
2021-11-15T08:00:51.920794+00:00 heroku[web.1]: Process exited with status 127
2021-11-15T08:00:51.998349+00:00 heroku[web.1]: State changed from starting to crashed
2021-11-15T08:00:52.006946+00:00 heroku[web.1]: State changed from crashed to starting
2021-11-15T08:00:52.312734+00:00 heroku[web.1]: Starting process with command `app-crm`
2021-11-15T08:00:53.169065+00:00 app[web.1]: bash: app-crm: command not found
2021-11-15T08:00:53.278936+00:00 heroku[web.1]: Process exited with status 127
2021-11-15T08:00:53.342179+00:00 heroku[web.1]: State changed from starting to crashed
I tried to change how to access the port several times too, but it still doesn't work...
is there anyway I could fix it?

Heroku - crash all the time

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).
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.
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

Heroku scheduler crashing

I'm having trouble with the scheduler add-on on Heroku. I had it running fine for a long time but now it is stuck in a loop of crashing and restarting.
I've tried stopping the process by running heroku ps:stop scheduler and I've removed the scheduler add-on but it still keeps restarting.
The task it was running was rake:cron. I've since emptied out that task so it's not actually doing anything but it still crashes after running it with the following message:
heroku[scheduler.5818]: State changed from up to crashed
heroku[scheduler.5818]: State changed from crashed to down
heroku[scheduler.5818]: State changed from down to starting
heroku[scheduler.5818]: Starting process with command `bundle exec rake cron`
heroku[scheduler.5818]: State changed from starting to up
heroku[scheduler.5818]: Process exited with status 0
heroku[scheduler.5818]: State changed from up to crashed
heroku[scheduler.5818]: State changed from crashed to starting
Is there any other way to force kill a process on Heroku? I'm worried I'm being billed for the constantly running/crashed scheduler.

heroku Error R10

I created a sample app called stock portfolio manager
https://github.com/rohanmoitra/foliomanage and deployed it on heroku. But whenever I try to run heroku rake db:migrate it times out and gives the following error.
2012-10-22T22:28:35+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process
failed to bind to $PORT within 60 seconds of launch
2012-10-22T22:28:35+00:00 heroku[web.1]: Stopping process with SIGKILL
2012-10-22T22:28:36+00:00 heroku[web.1]: Process exited with status 137
2012-10-22T22:28:36+00:00 heroku[web.1]: State changed from starting to crashed
Has anyone encountered this error before? Any help would be deeply appreciated
You shouldn't do migrations on heroku boot. The latter is limited to 60 seconds. Run migrations separately as a rake task. If you really, really want to do this though, you have to work around the boot timeout (https://github.com/dblock/heroku-forward could help).

Resources