Share via

All our APIs on Azure function_apps + API Management are responding with internal server error 500

Iain Wadie 20 Reputation points
2025-09-29T09:55:12.1+00:00

All our APIs on Azure function_apps + API Management are responding with internal server error 500

They were working on Friday evening but are not working this morning. Can you please point us to the source of the problem.

Azure API Management
Azure API Management

An Azure service that provides a hybrid, multi-cloud management platform for APIs.


Answer accepted by question author

LeelaRajeshSayana-MSFT 17,871 Reputation points Moderator
2025-10-01T01:40:52.75+00:00

@Iain Wadie Thanks for confirmation that issue has been resolved and you have observed one of the APIs getting hit with a lot of requests.

Based on the shared information over private message I have looked into the backed logs I can see the below error when APIM instance is trying to call the backend function 

System.Net.Sockets.SocketException (10055): An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full.

One of the possible reasons why you might see this exception is the Function App could be creating a client (for example HTTP, CosmosDB, Azure Storage, Event Grid etc) for each function call. If you see this in your function app, use Singleton Static clients so that the client instance will not be created for each call. If you function app has shared helper Classes, do follow the similar Static client creation for those Classes.

Additionally, here is how you can set up monitoring for the number of connections made by each app service in your app plan, using Azure portal:
Monitor > Metrics > Select a resource > Select subscription, resource group, then under Resource type make sure you only select App Services > Select your App service > Then in the graph under Metric select Connections > Aggregate to count


If the response helped, please do click Accept Answer and Yes, as it might be beneficial to other community members reading this thread. If you have any further query or require additional assistance, please do let us know. Thank you

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Iain Wadie 20 Reputation points
    2025-09-30T08:24:54.0433333+00:00

    I have now resolved this. It was due to one of the APIs getting hit with a lot of requests.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.