Heroku free dyno "Idling" mid-test: what killed it? - node.js

I have a Heroku free web app which was working nicely with my initial testing, but with a bigger test it just crashed:
2020-06-17T21:45:10.068131+00:00 app[web.1]: my last console.log message
2020-06-17T21:46:39.334604+00:00 heroku[web.1]: Idling
2020-06-17T21:46:39.336851+00:00 heroku[web.1]: State changed from up to down
2020-06-17T21:46:40.202867+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2020-06-17T21:46:40.240320+00:00 heroku[router]: at=info method=GET path="/sockjs/432/q7l5m7n6/websocket" host=not-my-real-app.herokuapp.com request_id=ec5f9418-fe2b-4b50-8f92-fb59e315f2ce fwd="CLIENT-IP" dyno=web.1 connect=0ms service=2415813ms status=101 bytes=175 protocol=https
2020-06-17T21:46:40.240323+00:00 heroku[router]: at=info method=GET path="/sockjs/106/0_a5cq0q/websocket" host=not-my-real-app.herokuapp.com request_id=5ca1d1cb-03d4-4107-887b-a206449692c7 fwd="CLIENT-IP" dyno=web.1 connect=0ms service=2321844ms status=101 bytes=175 protocol=https
+12 other similar messages, one per browser window connected
2020-06-17T21:46:40.288644+00:00 heroku[web.1]: Process exited with status 143
2020-06-17T21:46:40.451795+00:00 heroku[web.1]: Unidling
2020-06-17T21:46:40.459070+00:00 heroku[web.1]: Unidling
2020-06-17T21:46:40.464243+00:00 heroku[web.1]: State changed from down to starting
2020-06-17T21:46:40.469937+00:00 heroku[web.1]: Unidling
The logs seem to indicate that the dyno was stopped by Heroku. This was some time into my first test with many (14) simultaneous web clients connections, so it wasn't idle (certainly not for 30 minutes), and I have plenty (989.08) of free dyno hours remaining.
Do you know why my app might have been killed? I could upgrade to a hobby account, but I don't know if that would help.
Or could it be a crash of my application code, despite what the logs seem to show?
Details:
Free web dyno
mLab MongoDB add-on
Region: Europe
Stack: heroku-18
Framework: Node.js
Slug size: 47.2 MiB of 500 MiB

After testing this out many times, I found that Heroku killed my Dyno after 34:41 to 38:25 (mins:secs) from when it was started ("Unidling" to "Idling" messages). According to the documentation, it should only do this for idle Dynos. Each time I was using it throughout the ~35 minutes, ie. open connections, server activity (evidenced by console.log messages in the server log), and client-server traffic.
I switched to a "Hobby" type Dyno, and after that they ran uninterrupted. I just used it for 2 hours without trouble, and have tested it left idle overnight.
I can understand Heroku having a restriction on free apps, but these should be accurately documented. It does not speak well for their reliability as a hosting service that they kill Dynos without explanation or notification (as far as I can see). For me this is an ugly stain on their otherwise excellent service.

Related

Heroku, Stopping all processes with SIGTERM, Process exited with status 143

My backend was hosted on heroku for more than a month and was working fine. Now, today when i opened my website it shows this error in heroku logs.
heroku logs
`` 2022-11-26T13:59:37.770793+00:00 heroku[web.1]: Unidling 2022-11-26T13:59:37.773849+00:00
` 2022-11-26T13:59:37.770793+00:00 heroku[web.1]: Unidling 2022-11-26T13:59:37.773849+00:00 heroku[web.1]: State changed from down to starting 2022-11-26T13:`your text`59:40.671794+00:00 heroku[web.1]: Starting process with command `npm start` `2022-11-26T13:59:43.453482+00:00 app\[web.1\]:\`
2022-11-26T13:59:43.453508+00:00 app\[web.1\]: \> server#1.0.0 start
2022-11-26T13:59:43.453508+00:00 app\[web.1\]: \> node index.js
2022-11-26T13:59:43.453509+00:00 app\[web.1\]:
2022-11-26T13:59:43.936570+00:00 app\[web.1\]: Server started successfully on port 28406
2022-11-26T13:59:44.394629+00:00 heroku\[web.1\]: State changed from starting to up
2022-11-26T13:59:45.969634+00:00 app\[web.1\]: MongoDB Connected: ac-rbrrtx1-shard-00-02.hnnmtja.mongodb.net
2022-11-26T13:59:47.331529+00:00 heroku\[router\]: at=info method=GET path="/todos" host=to-do.herokuapp.com request_id=498c9348-ac27-4d03-98c5-ed9650e5b6d3 fwd="74.125.215.152" dyno=web.1 connect=0ms service=2501ms status=200 bytes=770 protocol=https
2022-11-26T14:35:38.862987+00:00 heroku\[web.1\]: Idling
2022-11-26T14:35:38.864646+00:00 heroku\[web.1\]: State changed from up to down
2022-11-26T14:35:39.633081+00:00 heroku\[web.1\]: Stopping all processes with SIGTERM
2022-11-26T14:35:39.834323+00:00 heroku\[web.1\]: Process exited with status 143
2022-12-02T12:31:11.037127+00:00 app\[api\]: Scaled to web#0:Eco by user api-maintenance#heroku.com
2022-12-08T18:34:07.067959+00:00 heroku\[router\]: at=error code=H14 desc="No web processes running" method=GET path="/robots.txt" host=to-do.herokuapp.com request_id=c7c564c9-6334-4140-bf27-6b0750093c26 fwd="5.255.253.147" dyno= connect= service= status=503 bytes= protocol=https\`\`
`
First, I would like to confirm whether you are using free plan of Heroku or not. Because Heroku stopped its free plan starting from November-26-2022.
For further information:
https://make.wordpress.org/plugins/2022/09/13/heroku-free-tier-being-retired/
If you have a paid version then it's a problem associated with dynos as the error is giving code H14 (last line). This is most likely the result of scaling your web dynos down to 0 dynos. Scale up your dynos to fix it.
For more information visit Heroku error codes:
Heroku error codes

Heroku H10 "App crashed" on wakeup; cleared by restarting dyno

I have a node.js web app running on a Heroku eco dyno. Eco dynos sleep if not used for 30 minutes. My app has been running on the free dynos for a couple of years without issue, and "upgraded" to eco when Heroku eliminated the free tier. A couple of weeks ago (suspiciously, the first day operating as eco instead of free) when we started work for the day every attempt to access the app returned "Application error". In the Heroku logs there was an H10 "App crashed" message for each access, but nothing else. Clicking "Restart all dynos" on the dashboard cleared the problem. Inconvenient, but problem solved.
Until this morning, exactly two weeks later, when it happened again. Manually restarting the dyno cleared it again. My app doesn't log or report any errors, because it doesn't get started. And the Heroku logs don't appear to contain any useful information.
I've made no changes to the app since the previous kerfuffle two weeks ago; it's been starting fine every morning.
Here's an example error message from logtail (xxx.xxx.xxx.xxx is our IP address):
2022-12-16 13:33:20.653 [exampledyno] router connect= GET exampledyno.herokuapp.com / xxx.xxx.xxx.xxx at=error code=H10 desc="App crashed" method=GET path="/" host=exampledyno.herokuapp.com request_id=[blah] fwd="xxx.xxx.xxx.xxx" dyno= connect= service= status=503 bytes= protocol=https
The last messages in the log prior to this are the normal "Idling" sequence as the dyno goes to sleep:
2022-12-15 22:59:00.585 [exampledyno] web.1 Idling
2022-12-15 22:59:00.587 [exampledyno] web.1 State changed from up to down
2022-12-15 22:59:01.567 [exampledyno] web.1 Stopping all processes with SIGTERM
2022-12-15 22:59:01.764 [exampledyno] web.1 1 Process exited with status 0
Then nothing overnight, until it fails to wake up the next morning.
Now I'd like to figure out what's happening because once is annoying but twice is the beginning of a pattern.

Heroku dyno keeps rebooting constantly

I've just deployed a new project to Heroku using Docker.
Unfortunately, my dyno is in a reboot cycle and hasn't come online yet. It continuously crashes with the following logs:
2021-01-07T09:49:55.706527+00:00 heroku[web.1]: Process exited with status 143
2021-01-07T09:51:44.917593+00:00 heroku[web.1]: Starting process with command `/bin/sh -c NODE_ENV\=production\ node\ ./dist/apps/server/main.js`
2021-01-07T09:51:45.800006+00:00 heroku[web.1]: State changed from starting to down
2021-01-07T09:51:45.802340+00:00 heroku[web.1]: State changed from down to starting
2021-01-07T09:51:54.256090+00:00 app[web.1]: Listening on :39134
2021-01-07T09:51:55.807447+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-01-07T09:51:56.049759+00:00 heroku[web.1]: Process exited with status 143
2021-01-07T09:52:09.979061+00:00 heroku[web.1]: Restarting
2021-01-07T09:53:18.197373+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=my-app.herokuapp.com request_id=a031ff96-2a06-46e0-85da-458f83430f0d fwd="49.178.36.98" dyno= connect= service= status=503 bytes= protocol=https
2021-01-07T09:53:33.346139+00:00 heroku[web.1]: Starting process with command `/bin/sh -c NODE_ENV\=production\ node\ ./dist/apps/server/main.js`
2021-01-07T09:53:39.162417+00:00 app[web.1]: Listening on :45111
2021-01-07T09:53:40.774891+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-01-07T09:53:40.887655+00:00 heroku[web.1]: Process exited with status 143
I've tried upgrading the dyno to Hobby, rebooted all dynos multiple times but nothing seems to fix it.
I am indeed listening on process.env.PORT.

Running URL after Heroku Deployment displays application error

I've created the project on GoormIDE and am trying to deploy it using Heroku, however it is giving error as
An error occurred in the application and your page could not be
served. If you are the application owner, check your logs for details.
You can do this from the Heroku CLI with the command heroku logs
--tail
I've tried running the application from Goorm itself and it is running without any error.
The Heroku logs say that
W 2020-06-04T13:40:13.026765+00:00 app[web.1]:
Server running at port 3000 2020-06-04T13:40:13.200053+00:00
app[web.1]: Connected 2020-06-04T13:41:09.692255+00:00 heroku[web.1]:
Error R10 (Boot timeout) -> Web process failed to bind to $PORT within
60 seconds of launch 2020-06-04T13:41:09.717907+00:00 heroku[web.1]:
Stopping process with SIGKILL 2020-06-04T13:41:09.833400+00:00
heroku[web.1]: Process exited with status 137
2020-06-04T13:41:09.879805+00:00 heroku[web.1]: State changed from
starting to crashed 2020-06-04T13:41:11.348533+00:00 heroku[router]:
at=error code=H10 desc="App crashed" method=GET path="/"
host=immense-harbor-74512.herokuapp.com
request_id=2bfa2066-edf0-4c28-bee0-b84522cae634 fwd= "27.60.111.103"
dyno= connect= service= status=503 bytes= protocol=httpsthen,
What is the problem and how to fix it
Procfile
web:guinicorn python app.py

Run Bitgo's Express service on Heroku - Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds

It is the first time I do something like this. Any pointers or tips to the right direction will greatly help.
I am trying to run this Bitgo's service on Heroku. I followed Heroku's tutorial and pushed the app.
This app is not a web app. It is a service receiving requests. I am wondering how I will run it to receive this requests on Heroku.
I created a "Procfile" and wrote the following line in it:
web: ./bin/bitgo-express
Then when I check the logs (without doing or trying anything at all) I get the following errors and logs:
2016-06-16T08:22:35.353721+00:00 heroku[web.1]: State changed from crashed to starting
2016-06-16T08:22:37.366281+00:00 heroku[web.1]: Starting process with command `./bin/bitgo-express`
2016-06-16T08:22:40.433443+00:00 app[web.1]: BitGo-Express running
2016-06-16T08:22:40.434385+00:00 app[web.1]: Environment: test
2016-06-16T08:22:40.434540+00:00 app[web.1]: Base URI: http://localhost:3080
2016-06-16T08:23:37.991458+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2016-06-16T08:23:37.991458+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-06-16T08:23:38.795553+00:00 heroku[web.1]: Process exited with status 137
2016-06-16T08:23:38.810670+00:00 heroku[web.1]: State changed from starting to crashed
2016-06-16T08:23:41.439218+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=example.com request_id=a42a1654-2593-499c-81fa-a585464b2805 fwd="109.110.240.32" dyno= connect= service= status=503 bytes=
2016-06-16T08:23:42.964194+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=example.com request_id=008620c3-b40f-43c1-add3-e3f8b785d5c5 fwd="109.110.240.32" dyno= connect= service= status=503 bytes=
A note. When I run this service locally it opens a website that redirects to a bitgo's website but I am also able to execute commands and work with the service.
I googled the error and tried this solution which proposes to change the listening port but I was still getting the same behaviour. Just to clarify on the bitgo app I changed all 3080 ports to 5000 that Heroku uses.
I then tried this solution which proposes to change the "web" process to "worker" but I was getting errors that they seem to be generated because of the reason that the service was not structured as a worker process (maybe, that is what I think) but web process.
And lastly, I changed the procfile's text to web: ./bin/bitgo-express -p 3080 so it runs at the 3080 port but I was still getting the same error
Edit:
I have web: ./bin/bitgo-express -p 5000 -b 0.0.0.0 in my procfile.
Again, same result. Here are the logs:
2016-06-20T06:17:36.753762+00:00 heroku[web.1]: Starting process with command `./bin/bitgo-express -p 5000 -b 0.0.0.0`
2016-06-20T06:17:39.333304+00:00 app[web.1]: BitGo-Express running
2016-06-20T06:17:39.334368+00:00 app[web.1]: Environment: test
2016-06-20T06:17:39.334384+00:00 app[web.1]: Base URI: http://0.0.0.0:5000
2016-06-20T06:18:36.768622+00:00 heroku[web.1]: Stopping process with SIGKILL
2016-06-20T06:18:36.768550+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
Make sure you specify -b or --bind as 0.0.0.0 in your Profile. Otherwise, it will try to bind to localhost, which cannot be reached from Heroku's routing tier.
You should use the $PORT environment variable provided by Heroku on your Procfile, i.e rails application: web: bin/rails server -p $PORT -e $RAILS_ENV
For BitGo you can configure like that: web: ./bin/bitgo-express -p $PORT -b 0.0.0.0

Resources