0

I have set up a server using IIS on Windows Service 2016 using python FastAPI with uvicorn. Sending individual querying works well, but I had been moving to testing the API with parallel queries using k6. I had been sending queries with 30 VU across 1min with a random sleep between, resulting in around 2.1 requests/sec. However I noticed that the service had been having sporadic 502.3 errors about 15% of the time.

The error codes tagged to it were: 12030 and 12152. According to https://learn.microsoft.com/en-us/windows/win32/winhttp/error-messages:

ERROR_WINHTTP_CONNECTION_ERROR

12030

The connection with the server has been reset or terminated, or an incompatible SSL protocol was encountered. For example, WinHTTP version 5.1 does not support SSL2 unless the client specifically enables it.

ERROR_WINHTTP_INVALID_SERVER_RESPONSE

12152

The server response cannot be parsed.

The failure percentage seems to scale with higher number of requests per second.

I had checked the httperr logs under C:\Windows\System32\LogFiles\HTTPERR, but only saw Timer_ConnectionIdle which I read to be not an issue.

How else can I troubleshoot these error 502.3 to see what the issue is?

UPDATE 2022/12/20:

Managed to get the FRT for one of the occurrences. How to proceed to troubleshoot? It does seem to be just indicate 502.3 error

Event: MODULE_SET_RESPONSE_ERROR_STATUS
ModuleName: httpPlatformHandler
Notification: EXECUTE_REQUEST_HANDLER
HttpStatus: 502
HttpReason: Bad Gateway
HttpSubStatus: 3
ErrorCode: 2147954552

enter image description here

jscodes
  • 23
  • 3
  • From where did you get 12030 and 12152? Usually IIS 502.3 error pages contain error codes like `0x80070005` (like in [this](https://halfblood.pro/running-flask-web-apps-on-iis-with-httpplatformhandler/)), not the codes you showed. – Lex Li Dec 19 '22 at 05:40
  • @LexLi I found these values in the IIS LogFiles in C:\inetpub\logs\LogFiles\W3SVC1 I will see lines like these that are captured: `2022-12-19 01:09:20 192.168.1.50 POST /api/test - 8000 - 192.168.0.130 k6/0.41.0+(https://k6.io/) - 502 3 12030 1139` `2022-12-19 01:09:21 192.168.1.50 POST /api/test - 8000 - 192.168.0.139 k6/0.41.0+(https://k6.io/) - 502 3 12152 979` – jscodes Dec 20 '22 at 02:49
  • Please enable FRT to learn more. I don't think those codes in IIS log files helpful enough, https://learn.microsoft.com/en-us/iis/troubleshoot/using-failed-request-tracing/troubleshoot-with-failed-request-tracing – Lex Li Dec 20 '22 at 03:59
  • @LexLi Thanks! I have gotten the logs and updated the thread with the screen shot. What can be seen here? – jscodes Dec 20 '22 at 08:43
  • Generally, 502.3 contains [these error messages](https://learn.microsoft.com/en-us/iis/extensions/troubleshooting-application-request-routing/troubleshooting-502-errors-in-arr). You can search for solutions according to your situation. About 12030 and 12152 error, you need to use FRT as the community member said. – TengFeiXie Dec 20 '22 at 08:52
  • @TengFeiXie thanks. I did get the FRT. How do I proceed to troubleshoot with the FRT? – jscodes Dec 21 '22 at 03:38
  • Based on what FRT recorded, IIS/HttpPlatformHandler detected malformed HTTP responses from uvicorn side, so it returned such errors. To learn more about the actual culprit, next you need to actually capture such responses and analyze further. Tools like Wireshark allow you to capture such localhost traffic, https://wiki.wireshark.org/CaptureSetup/Loopback Note it's not easy to move on, grab a network expert to assist if you can. – Lex Li Dec 21 '22 at 05:26
  • Perhaps this [answer](https://stackoverflow.com/questions/28730485/how-can-i-make-arr-work-with-ssl-offloading-disabled-502-3-bad-gateway/43226649#43226649) could provide some ideas for you. – TengFeiXie Dec 27 '22 at 06:02

0 Answers0