We suddenly began experiencing HTTP 502 errors (The specified CGI application encountered an error and the server terminated the process
) from one of the instances of our web app. I was able to determine this using Kudu's "Support" tab whereby you can drill down to metrics per instance.
After restarting w3wp for the instance everything continued successfully as normal. There were no problems with resource usage (CPU/RAM) and the odd thing is that the 502s were returning instantly. So, requests weren't timing out for the client.
What are the possible steps to investigate why this happened?
Our application logs wouldn't have anything and our web server logs only have the record of these 502 but with no further details.
After configuring an application gateway, one of the errors that you may see is "Server Error: 502 - Web server received an invalid response while acting as a gateway or proxy server". This error may happen for the following main reasons: NSG, UDR, or Custom DNS is blocking access to backend pool members.
Enable logging through the Azure portalIn the Azure portal, find your resource and select Diagnostic settings. For Application Gateway, three logs are available: Access log. Performance log.
In our case it seems to have come down to port exhaustion on the app service plan. Read here for more details on the limitations for each of the plans available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With