Heroku App won't deploy

Hey guys, so I’ve spent about 24 hours trying to debug my Heroku app (which is a take on the bear classifier). Here is my GitHub repository: BMW_Classifier. Here is my web app: BMW_Heroku.

Opening up my web app, I get an Application Error which points me to go to my logs. When I go there, here’s what I get:

2021-12-24T12:19:35.066144+00:00 heroku[web.1]: Restarting
2021-12-24T12:19:52.747299+00:00 heroku[web.1]: Starting process with command voila --port=42273 --no-browser --enable_nbextensions=True BMW_App.ipynb
2021-12-24T12:19:53.775262+00:00 heroku[web.1]: Starting process with command voila --port=55607 --no-browser --enable_nbextensions=True BMW_App.ipynb
2021-12-24T12:19:54.359020+00:00 app[web.1]: [Voila] Using /tmp to store connection files
2021-12-24T12:19:54.359347+00:00 app[web.1]: [Voila] Storing connection files in /tmp/voila_x6e378w5.
2021-12-24T12:19:54.359399+00:00 app[web.1]: [Voila] Serving static files from /app/.heroku/python/lib/python3.9/site-packages/voila/static.
2021-12-24T12:19:55.102661+00:00 app[web.1]: [Voila] Voilà is running at:
2021-12-24T12:19:55.102668+00:00 app[web.1]: http://localhost:42273/
2021-12-24T12:19:55.554237+00:00 app[web.1]: [Voila] Using /tmp to store connection files
2021-12-24T12:19:55.554574+00:00 app[web.1]: [Voila] Storing connection files in /tmp/voila_ke227i51.
2021-12-24T12:19:55.554624+00:00 app[web.1]: [Voila] Serving static files from /app/.heroku/python/lib/python3.9/site-packages/voila/static.
2021-12-24T12:19:56.380512+00:00 app[web.1]: [Voila] Voilà is running at:
2021-12-24T12:19:56.380519+00:00 app[web.1]: http://localhost:55607/
2021-12-24T12:20:39.000000+00:00 app[api]: Build succeeded
2021-12-24T12:20:42.600145+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-12-24T12:20:42.664934+00:00 app[web.1]: [Voila] Handle signal 15.
2021-12-24T12:20:42.872497+00:00 heroku[web.1]: Process exited with status 0
2021-12-24T12:20:54.249772+00:00 heroku[web.1]: Error R10 (Boot timeout) → Web process failed to bind to $PORT within 60 seconds of launch
2021-12-24T12:20:54.318676+00:00 heroku[web.1]: Stopping process with SIGKILL
2021-12-24T12:20:54.543197+00:00 heroku[web.1]: Process exited with status 137
2021-12-24T12:20:54.605706+00:00 heroku[web.1]: State changed from starting to crashed
2021-12-24T12:20:57.722867+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/" host=bmwapp.herokuapp.com request_id=fb5e8980-2b1c-4832-8063-53b41a6e809c fwd=“89.36.78.141” dyno= connect= service= status=503 bytes= protocol=https
2021-12-24T12:20:58.231893+00:00 heroku[router]: at=error code=H10 desc=“App crashed” method=GET path="/favicon.ico" host=bmwapp.herokuapp.com request_id=3f14c61c-6ee2-443a-a265-3f34f0513f88 fwd=“89.36.78.141” dyno= connect= service= status=503 bytes= protocol=https

There is an Error R10 (Boot timeout) happening for whatever reason. I tried extending my boot time from 60s all the way to 180s and still I get the same errors.

I’ve even gone as far as copying almost everything from another git user’s repository. No luck. I keep running into the same problem.

Any help would be GREATLY appreciated.

Alright, so I said screw it with Heroku and switch over to mybinder. After some tinkering I managed to get the app to spit out an error message (I believe this is what was causing Heroku to bug out as well).
Here it is:

UnpicklingError                           Traceback (most recent call last)
/tmp/ipykernel_49/375279062.py in <module>
      1 # path = Path()
----> 2 learn_inf = load_learner('export.pkl')

/srv/conda/envs/notebook/lib/python3.7/site-packages/fastai/learner.py in load_learner(fname, cpu, pickle_module)
    382     "Load a `Learner` object in `fname`, optionally putting it on the `cpu`"
    383     distrib_barrier()
--> 384     res = torch.load(fname, map_location='cpu' if cpu else None, pickle_module=pickle_module)
    385     if hasattr(res, 'to_fp32'): res = res.to_fp32()
    386     if cpu: res.dls.cpu()

/srv/conda/envs/notebook/lib/python3.7/site-packages/torch/serialization.py in load(f, map_location, pickle_module, **pickle_load_args)
    606                     return torch.jit.load(opened_file)
    607                 return _load(opened_zipfile, map_location, pickle_module, **pickle_load_args)
--> 608         return _legacy_load(opened_file, map_location, pickle_module, **pickle_load_args)
    609 
    610 

/srv/conda/envs/notebook/lib/python3.7/site-packages/torch/serialization.py in _legacy_load(f, map_location, pickle_module, **pickle_load_args)
    775             "functionality.")
    776 
--> 777     magic_number = pickle_module.load(f, **pickle_load_args)
    778     if magic_number != MAGIC_NUMBER:
    779         raise RuntimeError("Invalid magic number; corrupt file?")

UnpicklingError: invalid load key, 'v'.

After looking around on the web, it seems that this may stem from an issue of me using git lfs for my export.pkl file. I have no idea why binder doesn’t work properly with git lfs since I’ve got very little web dev experience, but I’ll continue looking.

Found the issue. I accidentally deleted my .gitattributes folder in order to match someone else’s repo. I learned that the .gitattributes directory is essential for git lfs. In order to solve the issue I deleted the export.pkl file within my repo and uploaded it back with git lfs, this time making sure to track the .gitattributes directory as well.

Link to my repository: BMW Classifier

Anyone else seeing “App boot timeout” while deploying to Heroku the simplest image classifier as per Lesson 2? How to fix?

Here the full log of app start:

2022-03-04T15:10:40.116435+00:00 heroku[web.1]: State changed from crashed to starting

2022-03-04T15:10:40.003839+00:00 heroku[web.1]: Process exited with status 137

2022-03-04T15:11:02.288401+00:00 heroku[web.1]: Starting process with command `voila --port=6752 --no-browser --enable_nbextensions=True sea_animals_classifier.ipynb`

2022-03-04T15:11:04.858274+00:00 app[web.1]: [Voila] Using /tmp to store connection files

2022-03-04T15:11:04.858815+00:00 app[web.1]: [Voila] Storing connection files in /tmp/voila_wrt2_zru.

2022-03-04T15:11:04.858897+00:00 app[web.1]: [Voila] Serving static files from /app/.heroku/python/lib/python3.9/site-packages/voila/static.

2022-03-04T15:11:05.885070+00:00 app[web.1]: [Voila] Voilà is running at:

2022-03-04T15:11:05.885094+00:00 app[web.1]: http://localhost:6752/

2022-03-04T15:11:14.399101+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=sea-animals-classifier.herokuapp.com request_id=9935e26c-2ed5-49b8-aa8c-04e6371f5236 fwd="194.110.114.251" dyno= connect= service= status=503 bytes= protocol=https

2022-03-04T15:10:42.000000+00:00 app[api]: Build succeeded

2022-03-04T15:12:02.813514+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

2022-03-04T15:12:02.890911+00:00 heroku[web.1]: Stopping process with SIGKILL

2022-03-04T15:12:03.063776+00:00 heroku[web.1]: Process exited with status 137

2022-03-04T15:12:03.137872+00:00 heroku[web.1]: State changed from starting to crashed

2022-03-04T15:12:03.896351+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sea-animals-classifier.herokuapp.com request_id=278043e3-64ec-44a4-9323-0da84c089825 fwd="194.110.114.251" dyno= connect= service= status=503 bytes= protocol=https

2022-03-04T15:12:06.253220+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sea-animals-classifier.herokuapp.com request_id=b214b71c-20c7-47c9-9bd2-9a28eb7baaa0 fwd="194.110.114.251" dyno= connect= service= status=503 bytes= protocol=https

Hey, as you can see, your logs say H20 and Error R10 (Boot timeout) → Web process failed to bind to $PORT within 60 seconds of launch
You also seem to launch on port 6752 which is probably hardcoded rather than the one Heroku is giving you through the PORT environment variable. I would simply advise to change to the env var and it should be fine

I already use env var. In my Procfile:

web: voila --port=$PORT --no-browser --enable_nbextensions=True sea_animals_classifier.ipynb

I follow Deploying to Heroku with Voila | Practical Deep Learning for Coders

It looks like it times out because of Heroku expects viola to start within 60 sec. Here is I tried again:



2022-03-05T09:24:27.000000+00:00 app[api]: Build succeeded

2022-03-05T09:24:33.240682+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

2022-03-05T09:24:33.311230+00:00 heroku[web.1]: Stopping process with SIGKILL

2022-03-05T09:24:33.463444+00:00 heroku[web.1]: Process exited with status 137

2022-03-05T09:24:33.541220+00:00 heroku[web.1]: State changed from starting to crashed

2022-03-05T09:24:33.545263+00:00 heroku[web.1]: State changed from crashed to starting

2022-03-05T09:24:54.087733+00:00 heroku[web.1]: Starting process with command `voila --port=50953 --no-browser --enable_nbextensions=True sea_animals_classifier.ipynb`

2022-03-05T09:24:56.613828+00:00 app[web.1]: [Voila] Using /tmp to store connection files

2022-03-05T09:24:56.614230+00:00 app[web.1]: [Voila] Storing connection files in /tmp/voila_ldtoufrh.

2022-03-05T09:24:56.614276+00:00 app[web.1]: [Voila] Serving static files from /app/.heroku/python/lib/python3.9/site-packages/voila/static.

2022-03-05T09:24:57.448978+00:00 app[web.1]: [Voila] Voilà is running at:

2022-03-05T09:24:57.448999+00:00 app[web.1]: http://localhost:50953/

Disconnected from log stream. There may be events happening that you do not see here! Attempting to reconnect...

2022-03-05T09:24:33.311230+00:00 heroku[web.1]: Stopping process with SIGKILL

2022-03-05T09:24:33.463444+00:00 heroku[web.1]: Process exited with status 137

2022-03-05T09:24:33.541220+00:00 heroku[web.1]: State changed from starting to crashed

2022-03-05T09:24:33.545263+00:00 heroku[web.1]: State changed from crashed to starting

2022-03-05T09:24:54.087733+00:00 heroku[web.1]: Starting process with command `voila --port=50953 --no-browser --enable_nbextensions=True sea_animals_classifier.ipynb`

2022-03-05T09:24:56.613828+00:00 app[web.1]: [Voila] Using /tmp to store connection files

2022-03-05T09:24:56.614230+00:00 app[web.1]: [Voila] Storing connection files in /tmp/voila_ldtoufrh.

2022-03-05T09:24:56.614276+00:00 app[web.1]: [Voila] Serving static files from /app/.heroku/python/lib/python3.9/site-packages/voila/static.

2022-03-05T09:24:57.448978+00:00 app[web.1]: [Voila] Voilà is running at:

2022-03-05T09:24:57.448999+00:00 app[web.1]: http://localhost:50953/

2022-03-05T09:25:55.007064+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 60 seconds of launch

2022-03-05T09:25:55.491556+00:00 heroku[web.1]: Stopping process with SIGKILL

2022-03-05T09:25:55.677512+00:00 heroku[web.1]: Process exited with status 137

2022-03-05T09:25:55.774246+00:00 heroku[web.1]: State changed from starting to crashed

2022-03-05T09:25:58.147192+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=sea-animals-classifier.herokuapp.com request_id=6a613c49-2b6a-41d6-b348-0f81b622f94f fwd="194.110.114.251" dyno= connect= service= status=503 bytes= protocol=https

1 Like

Hi, i am also getting similar errors, did you find a solution?

2022-03-24T10:06:05.420841+00:00 app[api]: Release v4 created by user ozanmerterol61@gmail.com
2022-03-24T10:06:06.552567+00:00 heroku[web.1]: State changed from crashed to starting
2022-03-24T10:06:29.782507+00:00 heroku[web.1]: Starting process with command `voila --port=25969 --no-browser --enable_nbextensions=True vehicle_app.ipynb`
2022-03-24T10:06:32.273876+00:00 app[web.1]: [Voila] Using /tmp to store connection files
2022-03-24T10:06:32.274441+00:00 app[web.1]: [Voila] Storing connection files in /tmp/voila_err22xgf.
2022-03-24T10:06:32.274502+00:00 app[web.1]: [Voila] Serving static files from /app/.heroku/python/lib/python3.10/site-packages/voila/static.
2022-03-24T10:06:33.213966+00:00 app[web.1]: [Voila] Voilà is running at:
2022-03-24T10:06:33.213985+00:00 app[web.1]: http://localhost:25969/
2022-03-24T10:07:20.000000+00:00 app[api]: Build succeeded
2022-03-24T10:07:36.813170+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=ozvnvehicle.herokuapp.com request_id=dfc69334-64a3-40b2-835d-5434d9a32947 fwd="144.122.106.54" dyno= connect= service= status=503 bytes= protocol=https
2022-03-24T10:08:52.292879+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/favicon.ico" host=ozvnvehicle.herokuapp.com request_id=f4b31e41-088b-41a3-a773-8a7f57f28190 fwd="144.122.106.54" dyno= connect= service= status=503 bytes= protocol=https
2022-03-24T10:08:59.042077+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/" host=ozvnvehicle.herokuapp.com request_id=1fe9ab69-e678-4cab-8497-5aea37b79120 fwd="144.122.106.54" dyno= connect= service= status=503 bytes= protocol=https
2022-03-24T10:09:30.218029+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 180 seconds of launch
2022-03-24T10:09:30.251482+00:00 heroku[web.1]: Stopping process with SIGKILL
2022-03-24T10:09:30.404133+00:00 heroku[web.1]: Process exited with status 137
2022-03-24T10:09:30.565877+00:00 heroku[web.1]: State changed from starting to crashed
2022-03-24T10:09:30.634569+00:00 heroku[web.1]: State changed from crashed to starting
2022-03-24T10:09:54.276676+00:00 heroku[web.1]: Starting process with command `voila --port=46348 --no-browser --enable_nbextensions=True vehicle_app.ipynb`
2022-03-24T10:09:56.799917+00:00 app[web.1]: [Voila] Using /tmp to store connection files
2022-03-24T10:09:56.800495+00:00 app[web.1]: [Voila] Storing connection files in /tmp/voila_youqwn1w.
2022-03-24T10:09:56.800562+00:00 app[web.1]: [Voila] Serving static files from /app/.heroku/python/lib/python3.10/site-packages/voila/static.
2022-03-24T10:09:57.754020+00:00 app[web.1]: [Voila] Voilà is running at:
2022-03-24T10:09:57.754039+00:00 app[web.1]: http://localhost:46348/
2022-03-24T10:10:14.502243+00:00 heroku[router]: at=error code=H20 desc="App boot timeout" method=GET path="/favicon.ico" host=ozvnvehicle.herokuapp.com request_id=033a062c-f78e-4919-a90f-846888201e09 fwd="144.122.106.54" dyno= connect= service= status=503 bytes= protocol=https
2022-03-24T10:12:54.446646+00:00 heroku[web.1]: Error R10 (Boot timeout) -> Web process failed to bind to $PORT within 180 seconds of launch
2022-03-24T10:12:54.477228+00:00 heroku[web.1]: Stopping process with SIGKILL
2022-03-24T10:12:54.670689+00:00 heroku[web.1]: State changed from starting to crashed
2022-03-24T10:12:54.613317+00:00 heroku[web.1]: Process exited with status 137
1 Like

I have the exact same issue, does anyone know how to solve it?

I think the answer can be found here: Deploying to Heroku not working on v0.3 · Issue #1047 · voila-dashboards/voila · GitHub

From 0.3.0, Voila will not listen on all interfaces by default (#926) for security reasons. In the case of Heroku, you need to add --Voila.ip=0.0.0.0 to your command in the Procfile to make it works.
Have a good day!

1 Like

Thanks! It worked for me.