Heroku Boot Timeout (Error R10)
Asked Answered
R

9

22

Every time I launch my app it cannot get past the 60 second point without:

2012-05-06T22:41:11+00:00 heroku[web.1]: Stopping process with SIGKILL
2012-05-06T22:41:11+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
2012-05-06T22:41:11+00:00 heroku[web.1]: Process exited with status 137
2012-05-06T22:41:12+00:00 heroku[web.1]: State changed from starting to crashed

Here is my Procfile:

web: bundle exec thin start -p $PORT

Any responses will be thoroughly appreciated.

Radiative answered 6/5, 2012 at 22:45 Comment(4)
I'm not convinced you'll get much in the way of useful responses without more data - definitely nothing else in the logs? Can you run things locally with Foreman? devcenter.heroku.com/articles/…Barbell
Yes, I can run things locally with Foreman. Also, changing my Procfile to something like web:bundle exec ruby app/models/code.rb -p $PORT does not change the command that heroku runs when starting my app. That is, it still tries to execute bundle exec thin start -p ...Radiative
Sounds like your Procfile might not be being used. Is it in the root of your Git repo?Barbell
You can make sure it is in your repo by running heroku run bash and then cat Procfile you should see the contents of your Procfile. How long does it take to start up locally?Dorison
I
15

If your app does take longer than 60 seconds for "good" reasons, you can work around the 60s boot time limit with https://github.com/dblock/heroku-forward.

Isocyanide answered 14/12, 2012 at 5:37 Comment(2)
Any recommendations on how to deduce those reasons? heroku logs shows just the fact that a R10 - Boot timeout occurred. Process exited with status 137 And.. that's it ;)Verdi
You could start by measuring how long each require takes. gist.github.com/dblock/4981231Isocyanide
P
11

The solution was that I had forgotten to include the -p $PORT in my Procfile line.

in Procfile change:

web: bundle exec thin start

to

web: bundle exec thin start -p $PORT

That fixed it for me.

Persimmon answered 4/2, 2014 at 18:41 Comment(0)
S
3

Heroku's boot timeout bit me too. I read several blog posts about how to get around it and ended up automating some of the solutions into a gem.

To reduce the startup time on deploy, you can trim the gems loaded at boot time (this doesn't mean you have to trim them from the app, just boot time).

gem_bench evaluates which gems are likely to not be needed at boot time.

I have an app with about 250 gems and was able to add :require => false to about 60 of them, with dramatic effects.

https://github.com/acquaintable/gem_bench

Disclaimer: I am the author of this open source ruby gem. I wrote the gem to aid myself in solving this exact problem: the 60 second timeout on Heroku.

Selfforgetful answered 23/4, 2013 at 21:37 Comment(2)
Hi, I have been using the gem....I noticed that, even if I mark something as require => false it still shows up as requiring false?Easement
@Angela I am not sure what you mean. Can you elaborate more in a bug tracker issue here please: github.com/pboling/gem_bench/issuesSelfforgetful
C
1

Hi i was facing the same issue.I have resolved this issue by increase the timeout in /config/unicorn.rb change timeout 15 to timeout 20 in /config/unicorn.rb

Cotidal answered 14/3, 2014 at 7:6 Comment(2)
This did it for me too. If boot takes more time than the unicorn limit, then it will end up in an endless loop as it never gets enough time to complete :)Poree
Where excatly can I find that path?Aston
O
0

In my case using nodejs I solved this adding a Procfile file with content: worker: node index.js and push it to heroku. After that make sure to disable the check "web npm start" and turn on the check "worker node index.js" just like the image attached below

herokuResourcesConfig

Ostia answered 26/4, 2019 at 5:53 Comment(0)
P
0

I was having the same error when deploying my Node app on Heroku.

I got it solved by adding a Procfile.

web: node app.js

It tells Heroku how to start the application.

The error is because of Heroku is not able to configure on which PORT to run the application.

It can be solved by specifying the PORT for Heroku, ie: in app.js

const PORT = process.env.PORT || 3000;
app.listen(PORT, () => {
    console.log(`App is running on port ${ PORT }`);
});
Phosphate answered 7/2, 2020 at 5:31 Comment(0)
L
0

Error R10 (Boot timeout) is this hidden section of heroku allows you to increase the deployment time.

https://tools.heroku.support/limits/boot_timeout

Lump answered 2/1, 2022 at 20:42 Comment(0)
C
0

I got this error because Heroku didn't have access to the Mongo Atlas database. You need to change this in the database settings

Cursorial answered 2/9, 2022 at 19:45 Comment(2)
In MongoAtlas, go to the "Network access" tab and allow everyone to connect to your databaseCursorial
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Aeolis
M
0

have the same issue, solved by creating file with proxy server https://www.npmjs.com/package/http-proxy#setup-a-basic-stand-alone-proxy-server

proxy.js:

httpProxy.createProxyServer({
    target, // target that can't cant be exposed, e.g. localhost:4000
    changeOrigin: true,
}).listen(process.env.PORT); // port from heroku runtime

then

node server/proxy.js
Maiamaiah answered 10/11, 2022 at 21:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.