albert-bert
albert-bert

Reputation: 93

Python heroku error H20 App boot timeout, R10 boot timeout

I do as the examples: http://flask.pocoo.org/docs/quickstart/, and I can run it well on my own machine after "foreman start", however when I deploy it on heroku, I got R10 timeout error.

I wrote the Procfileas :

web: python flaskr.py

and in order to run the "git push heroku master" command, I delete the "disreibute==0.6.24" sentence because if not, I would get an error as follows:

Traceback (most recent call last):
File "<string>", line 1, in <module>
NameError: name 'install' is not defined

So I don't know whether it is the Procfile or the requirements.txt file is wrong or something else is wrong. I almost read all articles I have found but the problem is not solved yet.

Besides, the example used SQLite3 database, I don't know whether it has something to do with this..

In the last, I will list the logs here:

at=error code=H20 desc="App boot timeout" method=GET path=/ host=tranquil-tor-4127.herokuapp.com request_id=8a088587-bee9-40e9-a686-0555843c191b fwd="8.35.201.53" dyno= connect= service= status=503 bytes=

Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch
Stopping process with SIGKILL
Process exited with status 137
at=error code=H10 desc="App crashed" method=GET path=/ host=tranquil-tor-4127.herokuapp.com request_id=59ccb901-e988-430d-93e8-f83a8930e60b fwd="8.35.201.50" dyno= connect= service= status=503 bytes=
at=error code=H10 desc="App crashed" method=GET path=/ host=tranquil-tor-4127.herokuapp.com request_id=7b76850f-7c25-481f-8216-542d9baaa769 fwd="8.35.201.51" dyno= connect= service= status=503 bytes=
Slug compilation started
State changed from crashed to starting
at=error code=H10 desc="App crashed" method=GET path=/ host=tranquil-tor-4127.herokuapp.com request_id=5601bbce-b00c-4927-8d9c-ac534745859d fwd="8.35.201.52" dyno= connect= service= status=503 bytes=

I noticed that slug compilation can finish normally and then R10 error follows.

Upvotes: 1

Views: 2937

Answers (1)

Iceberg
Iceberg

Reputation: 3332

The following solution for our node.js app might help anyone who ends up here.

Listening to 127.0.0.1 leads to the code=H20 desc="App boot timeout" problem for us. Changing the listening address to 0.0.0.0 solves the problem.

Also, don't use your own port, but instead use the environment variable PORT , which is passed to your app environment variables by heroku. Otherwise, you'll also get this problem.

Here is our node code:

const { PORT=3000, LOCAL_ADDRESS='0.0.0.0' } = process.env
server.listen(PORT, LOCAL_ADDRESS, () => {
  const address = server.address();
  console.log('server listening at', address);
});

So, try to log your listening address and port and check them firstly.

Upvotes: 3

Related Questions