ResponseCode = 0 in Azure APIM

Lily 116 Reputation points
2024-06-24T07:00:10.6533333+00:00

Hi,

We want to understand the root cause of the error "Client connection was unexpectedly closed."

We have API requests with ResponseCode = 0 in the APIM logs under ApiManagementGatewayLogs. The detailed error is:

  • ResponseCode: 0
  • BackendResponseCode: (blank)
  • LastErrorSource: forward-request
  • LastErrorScope:
  • Cache: none
  • LastErrorSection: backend
  • LastErrorReason: ClientConnectionFailure
  • LastErrorMessage: Client connection was unexpectedly closed.
  • Errors: [{"elapsed":5022,"source":"forward-request","path":"forward-request","reason":"ClientConnectionFailure","message":"Client connection was unexpectedly closed.","section":"backend"}]

After reviewing this post, we confirmed:

  1. No response body capture code in the policy.
  2. No buffer specified in the policy.

Regarding backend services, we found some issues:

  1. Logic apps with long-running processes that fail in the end (around 2-3 minutes).
  2. Logic apps with a duration of only 7 seconds but with an error in the final step, stating:
    • "The execution of template action 'Response_2' failed: the client application timed out waiting for a response from the service. This means the workflow took longer to respond than the allotted timeout value. The connection between the client application and service was closed, resulting in an HTTP status code 504 Gateway Timeout."
      User's image

We're not sure what the possible cause is or how to address it when APIM gets ResponseCode = 0 or a 504 Gateway Timeout.

Could you provide more insights into it ?

Azure API Management
Azure API Management
An Azure service that provides a hybrid, multi-cloud management platform for APIs.
1,908 questions
0 comments No comments
{count} votes