Home > OS >  Deploy dash app to heroku : Exception in worker process
Deploy dash app to heroku : Exception in worker process

Time:09-17

For the first time, I'm trying to run my python application by Dash in Heroku. i have created the required files like procfile and .gitignore files.

enter image description here

enter image description here

enter image description here

Anyhow when run the app, I have the following error. Always status changed to crashed. I Need support to find what I need to do in order to solve and run my Dash App in Heroku.

2021-09-15T13:56:18.197976 00:00 heroku[web.1]: Starting process with command `gunicorn app.py:server`
2021-09-15T13:56:19.436781 00:00 app[web.1]: [2021-09-15 13:56:19  0000] [4] [INFO] Starting gunicorn 20.1.0
2021-09-15T13:56:19.437103 00:00 app[web.1]: [2021-09-15 13:56:19  0000] [4] [INFO] Listening at: http://0.0.0.0:7398 (4)
2021-09-15T13:56:19.437139 00:00 app[web.1]: [2021-09-15 13:56:19  0000] [4] [INFO] Using worker: sync
2021-09-15T13:56:19.439891 00:00 app[web.1]: [2021-09-15 13:56:19  0000] [7] [INFO] Booting worker with pid: 7
2021-09-15T13:56:19.452686 00:00 app[web.1]: [2021-09-15 13:56:19  0000] [8] [INFO] Booting worker with pid: 8
2021-09-15T13:56:20.002245 00:00 heroku[web.1]: State changed from starting to up
2021-09-15T13:56:23.618004 00:00 app[web.1]: [2021-09-15 13:56:23  0000] [7] [ERROR] Exception in worker process
2021-09-15T13:56:23.618031 00:00 app[web.1]: Traceback (most recent call last):
2021-09-15T13:56:23.618032 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2021-09-15T13:56:23.618033 00:00 app[web.1]: worker.init_process()
2021-09-15T13:56:23.618033 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2021-09-15T13:56:23.618033 00:00 app[web.1]: self.load_wsgi()
2021-09-15T13:56:23.618034 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2021-09-15T13:56:23.618034 00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-09-15T13:56:23.618035 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-09-15T13:56:23.618035 00:00 app[web.1]: self.callable = self.load()
2021-09-15T13:56:23.618036 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2021-09-15T13:56:23.618036 00:00 app[web.1]: return self.load_wsgiapp()
2021-09-15T13:56:23.618036 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2021-09-15T13:56:23.618037 00:00 app[web.1]: return util.import_app(self.app_uri)
2021-09-15T13:56:23.618037 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2021-09-15T13:56:23.618037 00:00 app[web.1]: mod = importlib.import_module(module)
2021-09-15T13:56:23.618037 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2021-09-15T13:56:23.618038 00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-09-15T13:56:23.618039 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2021-09-15T13:56:23.618039 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2021-09-15T13:56:23.618039 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 981, in _find_and_load_unlocked
2021-09-15T13:56:23.618040 00:00 app[web.1]: ModuleNotFoundError: No module named 'app.py'; 'app' is not a package
2021-09-15T13:56:23.618175 00:00 app[web.1]: [2021-09-15 13:56:23  0000] [7] [INFO] Worker exiting (pid: 7)
2021-09-15T13:56:23.625881 00:00 app[web.1]: [2021-09-15 13:56:23  0000] [8] [ERROR] Exception in worker process
2021-09-15T13:56:23.625883 00:00 app[web.1]: Traceback (most recent call last):
2021-09-15T13:56:23.625883 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
2021-09-15T13:56:23.625884 00:00 app[web.1]: worker.init_process()
2021-09-15T13:56:23.625884 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 134, in init_process
2021-09-15T13:56:23.625884 00:00 app[web.1]: self.load_wsgi()
2021-09-15T13:56:23.625885 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
2021-09-15T13:56:23.625885 00:00 app[web.1]: self.wsgi = self.app.wsgi()
2021-09-15T13:56:23.625885 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-09-15T13:56:23.625886 00:00 app[web.1]: self.callable = self.load()
2021-09-15T13:56:23.625886 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
2021-09-15T13:56:23.625886 00:00 app[web.1]: return self.load_wsgiapp()
2021-09-15T13:56:23.625887 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
2021-09-15T13:56:23.625887 00:00 app[web.1]: return util.import_app(self.app_uri)
2021-09-15T13:56:23.625887 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/site-packages/gunicorn/util.py", line 359, in import_app
2021-09-15T13:56:23.625888 00:00 app[web.1]: mod = importlib.import_module(module)
2021-09-15T13:56:23.625888 00:00 app[web.1]: File "/app/.heroku/python/lib/python3.9/importlib/__init__.py", line 127, in import_module
2021-09-15T13:56:23.625889 00:00 app[web.1]: return _bootstrap._gcd_import(name[level:], package, level)
2021-09-15T13:56:23.625889 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
2021-09-15T13:56:23.625890 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
2021-09-15T13:56:23.625890 00:00 app[web.1]: File "<frozen importlib._bootstrap>", line 981, in _find_and_load_unlocked
2021-09-15T13:56:23.625890 00:00 app[web.1]: ModuleNotFoundError: No module named 'app.py'; 'app' is not a package
2021-09-15T13:56:23.626025 00:00 app[web.1]: [2021-09-15 13:56:23  0000] [8] [INFO] Worker exiting (pid: 8)
2021-09-15T13:56:24.247906 00:00 app[web.1]: [2021-09-15 13:56:24  0000] [4] [WARNING] Worker with pid 8 was terminated due to signal 15
2021-09-15T13:56:24.344291 00:00 app[web.1]: [2021-09-15 13:56:24  0000] [4] [INFO] Shutting down: Master
2021-09-15T13:56:24.344413 00:00 app[web.1]: [2021-09-15 13:56:24  0000] [4] [INFO] Reason: Worker failed to boot.
2021-09-15T13:56:24.563171 00:00 heroku[web.1]: Process exited with status 3
2021-09-15T13:56:24.713610 00:00 heroku[web.1]: State changed from up to crashed
2021-09-15T13:56:31.000000 00:00 app[api]: Build succeeded
2021-09-15T13:57:45.489893 00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=site-commissioning.herokuapp.com request_id=081836e3-fc61-4362-b0ef-d85b1496b987 fwd="175.157.33.240" dyno= connect= service
= status=503 bytes= protocol=https
2021-09-15T13:57:46.188832 00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=site-commissioning.herokuapp.com request_id=2766772f-27fe-430f-b3f2-f113b174876a fwd="175.157.33.240" dyno= conne
ct= service= status=503 bytes= protocol=https

CodePudding user response:

You shouldn’t include the .py extension in the Procfile, i.e. it should be app:server instead of app.py:server. Note that server must be a variable in app.py pointing to the Flask server object (you didn’t show the contents of app.py, so it is unclear if this is already the case).

  • Related