I have a Rails app deployed to Heroku. It currently has a 2x web dyno, and a 1x worker dyno. No active users at this point other than myself.
When the worker dyno is running, I get frequent H12 errors on app/web.1. When the worker stops, the errors stop.
Within the app, a user can upload a CSV file, and then DelayedJob runs a service on a worker that parses the CSV file, and saves Contact, EmailAddress and PhoneNumber objects to the database. There's some deduplication and some merging logic as well.
The worker runs flawlessly. But while it's running, I have a lot of trouble using the app. Most attempts to load a page end up timing out, and I see entries like this in the log:
Mar 31 10:52:54 abb heroku/router: at=error code=H12 desc="Request timeout" method=GET path="/contacts" host=abb.herokuapp.com request_id=a061e6b1-0233-4be1-9653-5db023d339ac fwd="99.17.86.166" dyno=web.1 connect=17ms service=30000ms status=503 bytes=0
Mar 31 10:53:18 abb heroku/router: at=error code=H12 desc="Request timeout" method=GET path="/" host=abb.herokuapp.com request_id=73d1e9e4-2e93-4e63-a86e-c8f90d22d172 fwd="50.250.42.142" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0
Mar 31 10:53:39 abb heroku/router: at=error code=H12 desc="Request timeout" method=POST path="/contacts" host=abb.herokuapp.com request_id=83753eec-774b-4939-8ad5-3b5876c14151 fwd="99.17.86.166" dyno=web.1 connect=1ms service=30012ms status=503 bytes=0
Mar 31 10:53:49 abb heroku/router: at=error code=H12 desc="Request timeout" method=GET path="/favicon.ico" host=abb.herokuapp.com request_id=575492b9-e997-4be5-8044-1be37ec2eda6 fwd="50.250.42.142" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0
I'm using Ruby 2.3, Rails 4.2.5.1, Postgres for the database, and I have the same problems with both Unicorn and Puma. Any ideas why the worker causing these issues?
Update
I discovered that I'm getting the same problem when I run the app locally in both development and production modes. When the worker is processing a CSV file, the app hangs.
Related
I have a spring boot rest api backend packed in a docker container and deployed to heroku under the free plan. It works and after a half hour it goes sleeping. But later, when I open the app and want to send some request, it doesn't start. I see from the logs, that the app was crashed.
Why is that? Why won't the app start? Why even was the app crashed, if it was shutting down gracefully?
Here is the log:
2022-02-27T19:58:05.770090+00:00 heroku[web.1]: Error R14 (Memory quota exceeded)
2022-02-27T19:58:22.938286+00:00 heroku[web.1]: Idling
2022-02-27T19:58:23.030649+00:00 heroku[web.1]: State changed from up to down
2022-02-27T19:58:23.707002+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2022-02-27T19:58:24.136754+00:00 app[web.1]: 2022-02-27 19:58:24.136 INFO 3 --- [ionShutdownHook] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2022-02-27T19:58:24.158799+00:00 app[web.1]: 2022-02-27 19:58:24.154 INFO 3 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown initiated...
2022-02-27T19:58:24.192171+00:00 app[web.1]: 2022-02-27 19:58:24.191 INFO 3 --- [ionShutdownHook] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Shutdown completed.
2022-02-27T19:58:24.493677+00:00 heroku[web.1]: Process exited with status 143
2022-02-28T10:01:59.256200+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=**** request_id=3e55141d-753c-4f91-b60b-2c78342f913a fwd="****" dyno= connect= service= status=503 bytes= protocol=https
2022-02-28T10:01:59.869943+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=**** request_id=c64f6bb8-d9af-41ca-ac11-47cdc542eb32 fwd="****" dyno= connect= service= status=503 bytes= protocol=https
2022-02-28T10:02:29.304593+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=**** request_id=9455eceb-fe52-41c4-9016-12496f2dce93 fwd="****" dyno= connect= service= status=503 bytes= protocol=https
I try to run my simple Web-App as Docker Container within Heroku.
When build and run the container locally all works fine.
But on accessing the generated endpoint https://html5-landingpage-buddah.herokuapp.com/ Heroku responses with HTTP 400 Bad Request and the message "Not authoritative"
Logs inside Heroku don't help much:
2020-09-19T14:45:45.269487+00:00 heroku[router]: at=info method=GET path="/" host=html5-landingpage-buddah.herokuapp.com request_id=5f07ea7e-d925-4fbe-b7ba-29387a3284cc fwd="XX.XX.XX.XXX" dyno=web.1 connect=1ms service=1ms status=400 bytes=212 protocol=https
I did a research for the error but found no helpful information.
Also re-creating the App in Heroku, renaming the URL and moving the App to another Region did not help.
Here is the log from restart to the first request on the web app:
2021-06-15T17:11:36.977277+00:00 heroku[web.1]: Starting process with command `./app`
2021-06-15T17:11:39.852345+00:00 app[web.1]: [main] INFO de.clique.westwood.example.html5.landingpage.buddah.App - Server started on port 54225
2021-06-15T17:11:39.852374+00:00 app[web.1]: [main] INFO de.clique.westwood.example.html5.landingpage.buddah.App - Serving albums from ./static/album
2021-06-15T17:11:41.363857+00:00 heroku[web.1]: State changed from starting to up
2021-06-15T17:11:48.162254+00:00 heroku[router]: at=info method=GET path="/" host=html5-landingpage-buddah.herokuapp.com request_id=85c642cb-a48d-41ac-89e1-7a520749e9bc fwd="94.31.82.142" dyno=web.1 connect=1ms service=4ms status=421 bytes=219 protocol=https
2021-06-15T17:11:48.275223+00:00 heroku[router]: at=info method=GET path="/" host=html5-landingpage-buddah.herokuapp.com request_id=406e9e77-f40e-47b9-a33b-af0af5b8f171 fwd="94.31.82.142" dyno=web.1 connect=1ms service=3ms status=421 bytes=219 protocol=https
2021-06-15T17:11:48.520876+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=html5-landingpage-buddah.herokuapp.com request_id=d3782734-765c-45f1-98a8-04e2098e7267 fwd="94.31.82.142" dyno=web.1 connect=1ms service=4ms status=421 bytes=219 protocol=https
2021-06-15T17:11:48.906097+00:00 heroku[router]: at=info method=GET path="/favicon.ico" host=html5-landingpage-buddah.herokuapp.com request_id=79e4404f-e505-4c16-9778-9f72882d74be fwd="94.31.82.142" dyno=web.1 connect=1ms service=4ms status=421 bytes=219 protocol=https
The error Not Authoritative simply means that Heroku is unable to redirect the traffic from the said domain name to your application.
According to Heroku,
The web process must listen for HTTP traffic on $PORT, which is set by Heroku. EXPOSE in Dockerfile is not respected, but can be used for local testing. Only HTTP requests are supported.
You will need to replace your EXPOSE and ENTRYPOINT as such
CMD [ "sh", "-c", "java -jar ./app --bind 0.0.0.0:$PORT" ]
I cannot seem to find the error in my rails app. The app was working fine but after a simple deploy (changing one controller file for an api), not a single page will load. The logs are of no help either:
2018-01-04T18:23:04.899516+00:00 app[web.1]: [4] * Listening on tcp://0.0.0.0:31202
2018-01-04T18:23:04.899701+00:00 app[web.1]: [4] Use Ctrl-C to stop
2018-01-04T18:23:05.040894+00:00 app[web.1]: [4] - Worker 0 (pid: 12) booted, phase: 0
2018-01-04T18:23:05.043093+00:00 app[web.1]: [4] - Worker 1 (pid: 15) booted, phase: 0
2018-01-04T18:23:05.394579+00:00 heroku[web.1]: State changed from starting to up
2018-01-04T18:23:11+00:00 app[heroku-redis]: source=REDIS sample#active-connections=2 sample#load-avg-1m=0.075 sample#load-avg-5m=0.08 sample#load-avg-15m=0.055 sample#read-iops=0 sample#write-iops=0 sample#memory-total=15664468kB sample#memory-free=12572192kB sample#memory-cached=1275064kB sample#memory-redis=300080bytes sample#hit-rate=0.99862 sample#evicted-keys=0
2018-01-04T18:23:45.338930+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=www..com request_id=d5b547d3-a969-4649-a729-66f9db19eb95 fwd="66.87.124.194" dyno= connect= service= status=503 bytes= protocol=https
2018-01-04T18:23:50.649738+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=www..com request_id=25924358-2142-46d0-8186-c516a6bafcb7 fwd="66.87.124.194" dyno= connect= service= status=503 bytes= protocol=https
2018-01-04T18:23:55.958718+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=www..com request_id=0eeb82f8-5bd8-4a95-bd07-8a9e023ae893 fwd="66.87.124.194" dyno= connect= service= status=503 bytes= protocol=https
any ideas? I've tried rolling back and that doesn't seem to fix anything?
Update:
Without doing anything it randomly started up again? Why would this happen?
2018-01-04T18:27:10.443578+00:00 app[web.1]: Started GET "/" for 24.60.204.37 at 2018-01-04 18:27:10 +0000
2018-01-04T18:27:10.572471+00:00 app[web.1]: Processing by StaticPagesController#home_v3 as HTML
2018-01-04T18:27:10.572498+00:00 app[web.1]: Parameters: {"secure"=>true}
Update 2:
It's back down again but the console works (heroku run rails c)?
This is a problem with Heroku at this time. Here is a link to their incident report: https://status.heroku.com/incidents/1367
Since approximately 18:10 UTC (1:10 PM Eastern), application Dynos are failing to start up after releases take place. Our engineers are investigating the cause of this issue.
Edit Could be coincidence, but I was restarting our app periodically, and now it is back up again. One person worked around this by beefing up a non-production instance and routing traffic to it.
Goal:
Going to https://secret-sands-1568.herokuapp.com/myFile.html will display the content of client/myFile.html sent by Nginx.
From what I understand, Heroku dynos are normally used for Nodejs/Ruby/other apps but they can be converted to anything by modifying the buildrack.
I copied the content of https://github.com/theoephraim/nginx-buildpack.
I added a folder named tmp with a file app-initialized.
I added a folder named client with a file myFile.html.
In config/nginx.conf.erb, I changed location / by
location / {
root client;
index index.html index.htm;
}
I created a file Procfile with content: web: bin/start-nginx.
I entered heroku config:set BUILDPACK_URL=https://github.com/ryandotsmith/nginx-buildpack.git.
I entered git init heroku create git push heroku master heroku ps:scale web=1.
Yet, when I go https://secret-sands-1568.herokuapp.com/myFile.html, there's nothing. Heroku logs says:
2015-05-19T07:13:32.990254+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:33.995458+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:34.998228+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:36.000823+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:37.005955+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:38.008548+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:39.011184+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:40.013788+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:41.016516+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:42.019372+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:43.023551+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:44.029985+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:45.035183+00:00 app[web.1]: buildpack=nginx at=app-initialization
2015-05-19T07:13:45.910618+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2015-05-19T07:13:45.910618+00:00 heroku[web.1]: Stopping process with SIGKILL
2015-05-19T07:13:46.732519+00:00 heroku[web.1]: State changed from starting to crashed
2015-05-19T07:13:46.718745+00:00 heroku[web.1]: Process exited with status 137
2015-05-19T07:17:12.890713+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=obscure-caverns-1927.herokuapp.com request_id=6d15e849-ce45-41bc-9bad-60d9eb0454ef fwd="24.200.222.98" dyno= connect= service= status=503 bytes=
2015-05-19T07:17:13.039723+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=obscure-caverns-1927.herokuapp.com request_id=7aeecc36-05b5-4799-bf0a-6ba97b2a6190 fwd="24.200.222.98" dyno= connect= service= status=503 bytes=
2015-05-19T07:17:18.350029+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/myFile" host=obscure-caverns-1927.herokuapp.com request_id=cb77356f-ddf3-4795-b56d-fa9cde5d134a fwd="24.200.222.98" dyno= connect= service= status=503 bytes=
2015-05-19T07:17:18.471762+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=obscure-caverns-1927.herokuapp.com request_id=64a89596-b287-4b89-a3ce-ed750e4fb1c1 fwd="24.200.222.98" dyno= connect= service= status=503 bytes=
2015-05-19T07:17:22.250495+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=obscure-caverns-1927.herokuapp.com request_id=4ccda4e8-1532-49dc-8658-e67312ef333d fwd="24.200.222.98" dyno= connect= service= status=503 bytes=
2015-05-19T07:17:22.125124+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/myFile.html" host=obscure-caverns-1927.herokuapp.com request_id=33cdee81-2dda-44cb-acf7-2dc5b4156ef2 fwd="24.200.222.98" dyno= connect= service= status=503 bytes=
What am I doing wrong? My goal is to have a stand-alone Nginx server that deserve static file.
Edit: For serving static files specifically, you don't need to go through all the effort of this. There's a buildpack heroku-community/static which is hugely more simple than the nginx ones, and the instructions cater to static sites. And I just got my Angular site working using it.
I know this probably won't help the original asker, but it will probably help others who find this.
Note: This is only a partial answer. I'm still looking for more debugs. But I managed to get mine to go from a Timeout to serving all 404 pages by doing the following.
Also note, I'm not using one from github. I'm using https://elements.heroku.com/buildpacks/heroku/heroku-buildpack-nginx, added via heroku buildpacks:add heroku-community/nginx
Procfile:
web: bin/start-nginx-solo
This should serve static files instead of trying to route to another listener.
So far, I keep getting nginx errors as follows: open() "/dist/index.html" failed (2: No such file or directory) (These are from app[web.1]). The build was successful, but it just can't locate any of the files. Still working on that, but at least it doesn't crash due to boot timeouts anymore.
I have reached the "Going Online With Heroku" section of One Month Rails.
After following the steps
` Pudge#PUDGE-PC ~/desktop/pinteresting (master)
$ heroku keys:add
Found the following SSH public keys:
1) github_rsa.pub
2) id_rsa.pub
Which would you like to use with your Heroku account? 2
Uploading SSH public key C:/Users/Pudge/.ssh/id_rsa.pub... done
Pudge#PUDGE-PC ~/desktop/pinteresting (master)
$ heroku create
Creating evening-oasis-5199... done, stack is cedar
http://evening-oasis-5199.herokuapp.com/ | git#heroku.com:evening-oasis-5199.git
Git remote heroku added`
I open the app at the given location and it comes back with "Application Error"
`←[36m2014-03-11T00:16:24.525751+00:00 heroku[api]:←[0m Enable Logplex by chitrad
er84#gmail.com
←[36m2014-03-11T00:16:24.525824+00:00 heroku[api]:←[0m Release v2 created by chi
trader84#gmail.com
←[33m2014-03-11T00:16:38.664429+00:00 heroku[router]:←[0m at=error code=H14 desc
="No web processes running" method=GET path=/ host=evening-oasis-5199.herokuapp.
com request_id=8229c76f-de74-43d6-ac14-fa3ecefe8ff6 fwd="99.9.45.163" dyno= conn
ect= service= status=503 bytes=
←[33m2014-03-11T00:26:09.486092+00:00 heroku[router]:←[0m at=error code=H14 desc
="No web processes running" method=GET path=/ host=evening-oasis-5199.herokuapp.
com request_id=afba73c5-ad0d-41a2-8d0c-9faf75dc4e0b fwd="99.9.45.163" dyno= conn
ect= service= status=503 bytes=
←[33m2014-03-11T00:26:09.717414+00:00 heroku[router]:←[0m at=error code=H14 desc
="No web processes running" method=GET path=/favicon.ico host=evening-oasis-5199
.herokuapp.com request_id=4c3f6b80-1f0a-42d5-80f6-3510b093872b fwd="99.9.45.163"
dyno= connect= service= status=503 bytes=
←[33m2014-03-11T00:28:09.983774+00:00 heroku[router]:←[0m at=error code=H14 desc
="No web processes running" method=GET path=/ host=evening-oasis-5199.herokuapp.
com request_id=21b356bb-cbcb-4489-82e5-6e6d0c69dfd5 fwd="99.9.45.163" dyno= conn
ect= service= status=503 bytes=
←[33m2014-03-11T00:28:10.239213+00:00 heroku[router]:←[0m at=error code=H14 desc
="No web processes running" method=GET path=/favicon.ico host=evening-oasis-5199
.herokuapp.com request_id=fcf0e24d-f9f6-42a5-b382-841ed9704e1e fwd="99.9.45.163"
dyno= connect= service= status=503 bytes=
←[32m2014-03-11T03:15:10+00:00 heroku[slug-compiler]:←[0m Slug compilation start
ed
←[32m2014-03-11T03:15:32+00:00 heroku[slug-compiler]:←[0m Slug compilation faile
d: failed to compile Ruby app
←[36m2014-03-11T03:15:57.572557+00:00 heroku[api]:←[0m Starting process with com
mand `rake db:migrate` by chitrader84#gmail.com
←[35m2014-03-11T03:15:59.264402+00:00 heroku[run.1396]:←[0m Starting process wit
h command `rake db:migrate`
←[35m2014-03-11T03:15:59.226632+00:00 heroku[run.1396]:←[0m Awaiting client
←[35m2014-03-11T03:15:59.359699+00:00 heroku[run.1396]:←[0m State changed from s
tarting to up
←[35m2014-03-11T03:16:01.043376+00:00 heroku[run.1396]:←[0m State changed from u
p to complete
←[35m2014-03-11T03:16:01.037656+00:00 heroku[run.1396]:←[0m Process exited with
status 1
←[33m2014-03-11T03:16:10.744992+00:00 heroku[router]:←[0m at=error code=H14 desc
="No web processes running" method=GET path=/favicon.ico host=evening-oasis-5199
.herokuapp.com request_id=add463f3-a0ad-4682-aa06-b0e7649481a3 fwd="99.9.45.163"
dyno= connect= service= status=503 bytes=
Here is what my log says.
So I just did a quick creation to test.
I did
step1:
rails new testapp
cd testapp
git add .
git commit -m 'initial commit'
heroku create
at this point, i did
heroku open
and I get the same application error with the same "No web processes running"
My feeling is you stopped here and not pushed your initial commit
You would need to run this additionally:
git push heroku master
heroku run rake db:migrate <--- only needed if you have migrations
heroku open
The error log says "No web processes running".
So how about running one?
Try this
heroku ps:scale web=1