5

I deployed a website using Azure Web Apps service, which is going to be mainly used as an API. The problem is that wfastcgi every so often throws out an error and the website goes down. The problem is that starting it back up takes a while, because the API is a prediction model and it needs to load some data.

The site runs on the Azure Web App python extension (tried both 3.6.4 and 3.5.4, both give the same error).

Used packages:

click==6.7
Flask==1.0.2
itsdangerous==0.24
Jinja2==2.9.6
MarkupSafe==1.0
Werkzeug==0.12.2
pandas==0.23.3
keras==2.2.0
scikit-learn==0.19.1
tensorflow==1.8.0

Error code:

2018-10-02 16:20:59.497482: Unhandled exception in wfastcgi.py: Traceback (most recent call last):
  File "D:\home\python354x64\wfastcgi.py", line 774, in main
    record = read_fastcgi_record(fcgi_stream)
  File "D:\home\python354x64\wfastcgi.py", line 158, in read_fastcgi_record
    data = stream.read(8)     # read record
OSError: [Errno 22] Invalid argument
2018-10-02 16:20:59.513123: Running on_exit tasks
2018-10-02 16:20:59.513123: wfastcgi.py 3.0.0 closed

As far as I can tell, it errors out on this command:

sys.stdin.detach().read(8)

Any ideas what might be causing this? Thank you!

Johny
  • 101
  • 6
  • 2
    Were you able to find out the root cause for this issue? – Mahesh Nayak Jun 26 '19 at 09:07
  • 1
    @MaheshNayak I think it was because the website kept being killed. In the end I had to create a web job to run every so often (15 minutes for example) to ping itself to keep the web app alive. – Johny Jun 26 '19 at 15:01
  • 1
    thanks, looks like a framework issue, so I have raised a ticket with Azure team. If something pans out, I will share it here. – Mahesh Nayak Jun 27 '19 at 05:10
  • 1
    Amazing, thanks! I posted to the azure forums, but didn't get a straight answer, just to try and make a webjob. Hope you have better luck than me – Johny Jun 28 '19 at 13:47

0 Answers0