Azure Sql Server Intermittent Timeouts

Mike-E-angelo 496 Reputation points
2024-03-03T11:12:52.38+00:00

I'm seeing the following in my logs:

Microsoft.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding.

This happens intermittently on a server that is currently not utilized at all.

How can it be timing out if hardly any usage is occurring? How can I track this down?

Thank you for any assistance you can provide.

Azure SQL Database
{count} votes

Accepted answer
  1. Erland Sommarskog 110.2K Reputation points
    2024-03-03T12:14:28.8+00:00

    By default, most client APIs wait for 30 seconds and if SQL Server has not completed within that time frame they will send an signal to SQL Server to stop executing the batch return the error "timeout expired" to SQL Server.

    The most common reason why this is happen is that the query is slow and would need more time to execute. The next most common reason is blocking. I don't know if in the context of Azure SQL Database it could be a matter or network issues. That is, the response from SQL Server gets lost somewhere. But I would expect that to manifest in a different way.

    I would recommend that you enhance your logging to see which statements that gets blocked, so that you can find the pattern.


1 additional answer

Sort by: Most helpful
  1. Haris Rashid 81 Reputation points
    2024-03-03T13:39:57.76+00:00

    Connection termination errors may occur because the database or elastic pool is temporarily unavailable. They may also occur because of various problems in the network infrastructure between the database server and the client application, including firewalls, network appliances, etc. These problems may be transient or permanent. As a general guidance, applications should use a fixed number of retry attempts for these errors before considering them permanent failures.

    See this link to diagnose this error: https://learn.microsoft.com/en-us/azure/azure-sql/database/troubleshoot-common-errors-issues?view=azuresql

    0 comments No comments

Your answer

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