简体   繁体   English

Azure Function 来自 SocketException 的代理内部服务器错误 500

[英]Azure Function Proxy Internal Server Error 500 from SocketException

I have an Azure Function that uses proxies and forwards to another azure function as the backend.我有一个 Azure Function 使用代理并转发到另一个 azure function 作为后端。 There is an /api/ping endpoint that accepts a GET.有一个接受 GET 的 /api/ping 端点。 When I send a HTTP-GET to ping I occasionally get a 500 Internal Server Error that it faulted where I only see the request on the proxy but I don't see the request on the backend code-executing function.当我发送一个 HTTP-GET 到 ping 时,我偶尔会收到一个 500 内部服务器错误,它在我只看到代理上的请求但看不到后端代码执行 function 上的请求时出现故障。

I added the header "Proxy-Trace-Enabled" for "true" to the header to trace the results.我在 header 中添加了 header "Proxy-Trace-Enabled" for "true" 来跟踪结果。 I have the results in my D:\home\LogFiles\Application\Proxies\DetailedTrace folder.我的 D:\home\LogFiles\Application\Proxies\DetailedTrace 文件夹中有结果。 In there the log for a failed request contains a "Backend" json object with the following在那里,失败请求的日志包含一个“后端”json object,其中包含以下内容

{
    "source": "forward-request",
    "timestamp": "2020-08-20T15:42:20.8272145Z",
    "elapsed": "00:00:00.0061051",
    "data": {
      "messages": [
        "Only one usage of each socket address (protocol/network address/port) is normally permitted Only one usage of each socket address (protocol/network address/port) is normally permitted",
        "Only one usage of each socket address (protocol/network address/port) is normally permitted",
        "Only one usage of each socket address (protocol/network address/port) is normally permitted"
      ]
    }
  }

I believe this is Azure Functions 1.0 on DotNet, but it was created a long time ago.我相信这是 DotNet 上的 Azure Functions 1.0,但它是很久以前创建的。 Why is my simple Azure Function proxy giving me internal server errors that are not forwarding to my backend code to execute?为什么我的简单 Azure Function 代理给我内部服务器错误,这些错误没有转发到我的后端代码来执行?

For reference on how to trace the requests 有关如何跟踪请求的参考

There are TCP Connection thresholds for Azure Function App Service Plans which correlate to the socket connections.有 TCP 连接阈值 Azure Function 与套接字连接相关的应用程序服务计划。 The documentation was in a blog I'll link here.该文档位于我将在此处链接的博客中。 There was a similar question on TCP/Port Exhaustion that uses a similar correlation between issues .在 TCP/Port Exhaustion 上有一个类似的问题,它在问题之间使用了类似的相关性 While the exception reported is different the errors go away in my testing when scaling up the app service it's on.虽然报告的异常不同,但在我扩展其所在的应用程序服务时,我的测试中出现了错误 go。

Example: I have 2 Azure Functions, FunctionA and FunctionB.示例:我有 2 个 Azure 函数,FunctionA 和 FunctionB。 FunctionA is a proxy and with no backend execution on App Service Plan P1. FunctionA 是一个代理,在 App Service Plan P1 上没有后端执行。 FunctionB is non-correlated function but executes on the same App Service Plan P1. FunctionB 是不相关的 function 但在同一个 App Service Plan P1 上执行。

FunctionA under the App Service Plan P1 faults with Internal 500 Server Error issues when called.应用服务计划 P1 下的 FunctionA 在调用时出现内部 500 服务器错误问题。 Reported as Faulted in App Insights, and traced in the backend logs as a socket exception.在 App Insights 中报告为 Faulted,并在后端日志中作为套接字异常进行跟踪。

I recreated the Azure Function, FunctionA, on App Service Plan P3.我在 App Service Plan P3 上重新创建了 Azure Function,FunctionA。 FunctionA did not receive 500 Internal Server Errors. FunctionA 没有收到 500 个内部服务器错误。 However it does not require the scale of a P3 payment plan.但是,它不需要 P3 付款计划的规模。 So I moved it back to the P1.所以我把它移回了P1。 Server errors occurred again.服务器错误再次发生。

FunctionB was on the same App Service Plan as FunctionA (P1). FunctionB 与 FunctionA (P1) 使用相同的应用服务计划。 Azure Monitoring Metrics summed up 4,200 SocketOutboundAll per minute. Azure 监控指标每分钟汇总 4,200 个 SocketOutboundAll。 I moved(deleted and recreated) FunctionB from P1 to P3.我将 FunctionB 从 P1 移动(删除并重新创建)到 P3。 I Kept FunctionA on P1.我将 FunctionA 保留在 P1 上。 The errors of SocketOutboundAll have been eliminated from FunctionA on P1. SocketOutboundAll 的错误已从 P1 上的 FunctionA 中消除。 Functions on P3 App Service Plan are not reporting any exceptions either. P3 App Service Plan 上的功能也没有报告任何异常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM