1

The function was working before the last deployment. It is used for NLC and we are running two functions for two different languages. For the new deployment we removed some code which was only used for one language and mirrored the code to be equal to the other language. Azure CLI tells us:

Upload completed successfully.
Deployment completed successfully. 

But when trying to invoke the function afterwards it either returns 500 without a body or it returns 404 with:

<html>
<head>
    <title>404 Not Found</title>
</head>
<body bgcolor="white">
    <center>
        <h1>404 Not Found</h1>
    </center>
    <hr>
    <center>nginx</center>
</body>
</html>



The stacktrace we can see in the monitoring is the following:
Exception while executing function: Functions.classify Result: Failure
Exception: OSError: [Errno 107] Transport endpoint is not connected: '/home/site/wwwroot/.python_packages/lib/site-packages'
Stack: File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/dispatcher.py", line 271, in _handle__function_load_request
func = loader.load_function(
File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/utils/wrappers.py", line 32, in call
return func(*args, **kwargs)
File "/azure-functions-host/workers/python/3.8/LINUX/X64/azure_functions_worker/loader.py", line 76, in load_function
mod = importlib.import_module(fullmodname)
File "/usr/local/lib/python3.8/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 961, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1014, in _gcd_import
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 975, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 671, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 783, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/home/site/wwwroot/classify/__init__.py", line 4, in <module>
File "/home/site/wwwroot/classify/predict.py", line 1, in <module>
File "/home/site/wwwroot/.python_packages/lib/site-packages/fastai/text/all.py", line 1, in <module>
File "/home/site/wwwroot/.python_packages/lib/site-packages/fastai/basics.py", line 1, in <module>
File "/home/site/wwwroot/.python_packages/lib/site-packages/fastai/data/all.py", line 1, in <module>
File "/home/site/wwwroot/.python_packages/lib/site-packages/fastai/torch_basics.py", line 1, in <module>
File "/home/site/wwwroot/.python_packages/lib/site-packages/torch/__init__.py", line 482, in <module>
File "/home/site/wwwroot/.python_packages/lib/site-packages/torch/serialization.py", line 8, in <module>
File "<frozen importlib._bootstrap>", line 991, in _find_and_load
File "<frozen importlib._bootstrap>", line 971, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 914, in _find_spec
File "<frozen importlib._bootstrap_external>", line 1342, in find_spec
File "<frozen importlib._bootstrap_external>", line 1314, in _get_spec
File "<frozen importlib._bootstrap_external>", line 1443, in find_spec
File "<frozen importlib._bootstrap_external>", line 1483, in _fill_cache

Commands used for deployment were the following, which worked before:

pip3 install  --target="./.python_packages/lib/site-packages" -r requirements.txt 
func azure functionapp publish [functionapp name] --no-build
  • Deleting the python packages and rebuilding etc. did not change anything.
  • I tried creating a new function app from scratch but it shows the same errors.
  • I tried to deploy from the folder of the other language with one file swapped (classifier language model) but it showed the same error. I fear trying to redeploy the working language for testing as it is working and I don't want to kill it.
Luca H
  • 123
  • 10
  • Is this [post](https://stackoverflow.com/questions/34249188/oserror-errno-107-transport-endpoint-is-not-connected) helpful to your problem ? – Hury Shen Jan 20 '21 at 02:26
  • No, because we are not creating any sockets ourselves. This should be handled by Azure I think. Thank you anyway. – Luca H Jan 20 '21 at 05:00

1 Answers1

0

It seems to be happening somewhere during module import. Though I am not sure how it was working before (as you mentioned), but I suggest you not to do pip3 install manually and remove --no-build flag to let the func azure functionapp publish handle that. Just make sure you have the requirements.txt in the root.

# no pip install manually
# without --no-build flag
func azure functionapp publish [functionapp name]
krishg
  • 5,935
  • 2
  • 12
  • 19
  • If we use 'func azure functionapp publish [name] --no-zip' or 'func azure functionapp publish [functionapp name] --build remote' it is only uploading ~95MB, while our model has 150MB alone. It then fails with "Remote build failed!". Publish without --no-zip results in the error 'Server Response: Run-From-Zip is set to a remote URL using WEBSITE_RUN_FROM_PACKAGE or WEBSITE_USE_ZIP app setting. Deployment is not supported in this configuration.' But I can't find these settings in the configuration, thus I don't understand where that issue lies. – Luca H Jan 21 '21 at 14:51
  • If you don't use zip, then `WEBSITE_RUN_FROM_PACKAGE` should be `0`. You can set that in FunctionApp->Configuration->AppSettings in Azure portal. – krishg Jan 21 '21 at 15:29