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.

Kristian Glass
  • 37,325
  • 7
  • 45
  • 73
camelCase
  • 303
  • 1
  • 3
  • 13
  • 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`? https://devcenter.heroku.com/articles/procfile#developing_locally_with_foreman – Kristian Glass May 07 '12 at 00:45
  • 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 ... – camelCase May 07 '12 at 00:50
  • Sounds like your Procfile might not be being used. Is it in the root of your Git repo? – Kristian Glass May 07 '12 at 13:54
  • 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? – Schneems May 09 '12 at 18:25

9 Answers9

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.

dB.
  • 4,700
  • 2
  • 46
  • 51
  • 1
    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 ;) – Trip Feb 18 '13 at 13:38
  • 1
    You could start by measuring how long each require takes. https://gist.github.com/dblock/4981231 – dB. Feb 18 '13 at 22:09
10

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.

saintsjd
  • 319
  • 1
  • 3
  • 10
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.

Peter H. Boling
  • 512
  • 5
  • 14
  • 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? – Satchel May 19 '17 at 22:17
  • @Angela I am not sure what you mean. Can you elaborate more in a bug tracker issue here please: https://github.com/pboling/gem_bench/issues – Peter H. Boling Jul 05 '17 at 21:27
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

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

Lucas Fcz
  • 1
  • 1
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 }`);
});
Suresh Mangs
  • 705
  • 8
  • 19
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

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

  • In MongoAtlas, go to the "Network access" tab and allow everyone to connect to your database – Oleksii Hyrba Sep 02 '22 at 19:48
  • 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](/help/how-to-answer). – Community Sep 11 '22 at 04:21
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
viewskiyui
  • 21
  • 1
  • 6