question

AzureUser-6972 avatar image
0 Votes"
AzureUser-6972 asked azure-cxp-api edited

Cannot Resolve 502 Error

We consistently get this error after using the web app for short periods of time:

85485-image.png


I have been through this document, but have not found a solution yet. There is a public IP address in front of the web app. I think that this is a gateway and they gateway is not getting a response from the back-end API, but I don't have any logs at the IP address level to know whether this is true or not. I have mostly been focusing on the Application Insights logs. I don't see any exceptions or other information that tells me that the back-end is having any issues. The app mostly works OK, and then stops responding. The app doesn't seem to have any issues when I run it locally.

This is the memory working set metric for the web app. It does seem to rise until it drops right off, but I can't find any correlation with the 502s at this time.

85502-image.png

CPU time, again with some strange spikes.

85449-image.png

In the gateway logs, I see lots of httpStatus_d = 502 messages, but they don't really tell me anything. They don't tell me what Url in the back-end the browser was trying to hit, so I can't diagnose the issue.

Edit: actually I was wrong. ^^ the request Url is in the requestUri_s column in the logs. This looks like it might help a lot.

azure-webapps-performanceazure-webapps-monitoring
image.png (24.1 KiB)
image.png (51.8 KiB)
image.png (52.7 KiB)
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

This query on the gateway is giving me useful results.

AzureDiagnostics
| extend httpStatus_d = httpStatus_d
| extend requestUri_s = requestUri_s
| summarize TimeTaken = avg(todouble( timeTaken_d)) by requestUri_s , httpStatus_d
| where httpStatus_d == 502
| order by TimeTaken

It does appear that the back-end calls are exceeding the timeout of 20 seconds.

1 Vote 1 ·

Hi @AzureUser-6972,

Have you tried sending your logs to you Azure Monitor; see https://docs.microsoft.com/en-us/azure/app-service/troubleshoot-diagnostic-logs#send-logs-to-azure-monitor-preview? AppServiceHTTPLogs may provide additional details on the IP and requests being made.

Regards,
Ryan

0 Votes 0 ·

0 Answers