Reputation: 31
[Hosted on Azure App Services] Container crashing due to this error:
2021-07-05T20:06:22.251645248Z [2021-07-05 20:06:22 +0000] [39] [ERROR] Exception in worker process
2021-07-05T20:06:22.251697248Z Traceback (most recent call last):
2021-07-05T20:06:22.251703748Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/arbiter.py", line 583, in spawn_worker
2021-07-05T20:06:22.251717048Z worker.init_process()
2021-07-05T20:06:22.251720748Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/workers/base.py", line 119, in init_process
2021-07-05T20:06:22.251724048Z self.load_wsgi()
2021-07-05T20:06:22.251727348Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/workers/base.py", line 144, in load_wsgi
2021-07-05T20:06:22.251730548Z self.wsgi = self.app.wsgi()
2021-07-05T20:06:22.251733548Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/app/base.py", line 67, in wsgi
2021-07-05T20:06:22.251736848Z self.callable = self.load()
2021-07-05T20:06:22.251757848Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 49, in load
2021-07-05T20:06:22.251761348Z return self.load_wsgiapp()
2021-07-05T20:06:22.251764548Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/app/wsgiapp.py", line 39, in load_wsgiapp
2021-07-05T20:06:22.251767848Z return util.import_app(self.app_uri)
2021-07-05T20:06:22.251771048Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/gunicorn/util.py", line 358, in import_app
2021-07-05T20:06:22.251774448Z mod = importlib.import_module(module)
2021-07-05T20:06:22.251777648Z File "/opt/python/3.8.6/lib/python3.8/importlib/init.py", line 127, in import_module
2021-07-05T20:06:22.251780948Z return _bootstrap._gcd_import(name[level:], package, level)
2021-07-05T20:06:22.251784148Z File "", line 1014, in _gcd_import
2021-07-05T20:06:22.251787748Z File "", line 991, in find_and_load
2021-07-05T20:06:22.251791048Z File "", line 975, in find_and_load_unlocked
2021-07-05T20:06:22.251794448Z File "", line 671, in load_unlocked
2021-07-05T20:06:22.251797748Z File "", line 783, in exec_module
2021-07-05T20:06:22.251801148Z File "", line 219, in call_with_frames_removed
2021-07-05T20:06:22.251804448Z File "/tmp/8d93fef9d493aa0/app.py", line 11, in
2021-07-05T20:06:22.251807848Z model = pickle.load(open("testmodel.pkl", "rb"))
2021-07-05T20:06:22.251811248Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/lightgbm/init.py", line 8, in
2021-07-05T20:06:22.251837848Z from .basic import Booster, Dataset, register_logger
2021-07-05T20:06:22.251841848Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/lightgbm/basic.py", line 95, in
2021-07-05T20:06:22.251845448Z LIB = load_lib()
2021-07-05T20:06:22.251848548Z File "/tmp/8d93fef9d493aa0/antenv/lib/python3.8/site-packages/lightgbm/basic.py", line 86, in load_lib
2021-07-05T20:06:22.251855148Z lib = ctypes.cdll.LoadLibrary(lib_path[0])
2021-07-05T20:06:22.251858548Z File "/opt/python/3.8.6/lib/python3.8/ctypes/init.py", line 451, in LoadLibrary
2021-07-05T20:06:22.251862048Z return self.dlltype(name)
2021-07-05T20:06:22.251865248Z File "/opt/python/3.8.6/lib/python3.8/ctypes/init.py", line 373, in init
2021-07-05T20:06:22.251868648Z self._handle = _dlopen(self._name, mode)
2021-07-05T20:06:22.251871848Z OSError: libgomp.so.1: cannot open shared object file: No such file or directory
2021-07-05T20:06:22.266878123Z [2021-07-05 20:06:22 +0000] [39] [INFO] Worker exiting (pid: 39)
2021-07-05T20:06:22.712631686Z [2021-07-05 20:06:22 +0000] [37] [INFO] Shutting down: Master
2021-07-05T20:06:22.712655786Z [2021-07-05 20:06:22 +0000] [37] [INFO] Reason: Worker failed to boot.
Tried adding libgomp1 to requirements.txt, wasn't of any help.
Upvotes: 2
Views: 2031
Reputation: 11
The root cause is that the libgomp1 is missing in the docker container, so we need to install it.
How to install it:
Create a startup.sh
file with the below commands:
#!/bin/sh
apt update
apt-get install -y libgomp1
gunicorn app:app
Move the startup.sh
file to the /home
folder in the Azure App
Service. You can use FTP to upload; you can also use the bash feature from the Kudu UI (Advanced tools) to create this file directly using a text editor (vim / emacs)
Go to Configuration -> General Settings -> Startup, and enter /home/startup.sh
Save the configuration; it will restart the app.
Upvotes: 1
Reputation: 1227
Thank you Avi Coomar. Posting the answers from Microsoft Q&A to help other community members
Refer below for fixing the issue: https://github.com/Azure/azure-functions-python-worker/issues/493 https://github.com/Azure/azure-functions-python-worker/issues/497#issuecomment-540830721
Upvotes: 0