Heroku scheduler crashing - heroku

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.

Related

Heroku discord bot keeps restarting

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.

Laravel horizon supervisor does not restart after horizon::terminate with forge daemon running

Horizon runs fine but only recently, after a deploy, supervisor and queue workers do not start back up again with Horizon GUI showing "Inactive"
To get them running again I can:
restart the daemon worker from within forge
restart the supervisor /etc/init.d/supervisor restart
My deploy script has php artisan horizon:terminate within it. I have also tried reset/purge and a combination thereof.
When I run terminate in the command with an inactive horizon, it seems to do nothing. When I run the same command with horizon active, it shuts it down but the daemon does not reboot supervisor.
The daemon runs without any errors throughout all of this.
Should terminate take down and bring up the service or is it the daemon itself?
Running horizon:terminate will kill the daemon, when the daemon is killed supervisor will realize this and boot up a new daemon. You can clearly see this if you monitor your server with htop while running terminate command.
If a long running job is running, it will run the current job until it finishes. Terminate in general is to reboot the process, to be certain the new code is loaded into horizon, this should be done after the last step in envoyer or similar deployment tool.
This seems like there is something wrong in your setup. Does the horizon process run before you call terminate, again check htop?. Or what happens when the command is called manually?

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 running a daemon process

I'm trying to run a deamon process running on heroku.
The framework-less app is just a ruby script which after being launched monitors my twitter stream and if there is a tweet with a photo then publish it on a tumblr.
Locally it runs just fine, but when I run it on heroku it just crashes right away.
heroku[worker.1]: Starting process with command `bundle exec ruby twitter-to-tumblr.rb start`
heroku[worker.1]: State changed from starting to up
heroku[worker.1]: Process exited with status 0
heroku[worker.1]: State changed from up to crashed
I'm kind of a newbie with ruby and heroku and I'm missing something here, any help is really appreciated.
Thank you
You need to ensure that that parent process doesn't exit. Your code is most likely forking a daemon with a PID and then the parent process exits with status 0. A status of 0 means the program is finished and everything is OK. Heroku only knows that the process you asked it do finished and If you keep the parent process around it should work. The parent can then also handle signal processing for the child.
Based on your procfile command I'm guessing you are using the 'daemons' gem to handle the daemonization. You can keep the parent running by passing in the ontop option to the run command. This prevents the parent from exiting:
Daemons.run_proc('tweetzilla', {:ontop => true}) do
# => long running code here.
end

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