Azure function app throws "database communication link failure" error and stops working

Nethmal Warusamana 1 Reputation point
2022-03-11T05:59:52.083+00:00

The HTTP triggered function app is built using Python 3.x and uses pyodbc with ODBC Driver 17 for SQL Server to communicate with the SQL server DB which has been deployed in the same resource group and the same region. The function app throws ('08S01', '[08S01] [Microsoft][ODBC Driver 17 for SQL Server]Communication link failure (0) (SQLExecDirectW)') error (used logs to validate) from time to time and returns an error as the response.

This issue gets immediately resolved once we re-deploy the function app and keeps working for a period of time and becomes apparent again (re-deployed yesterday evening due to the issue and worked fine until re-checked in the morning and the issue was there again). This function app was working as expected until a couple of days before when we released a newer version with some improvements.

We have the exact same function app (the latest version) and setup (including the DB) deployed in 2 other Azure directories (the Dev and Test instances) and they are working without a hitch. The only difference is the service tier (the production version uses a premium plan while the dev and test use consumption plans).

Tried disabling the "always on - keeping at least one function app instance running" feature on the premium plan to verify whether it's due to a DB session issue but that didn't work as well. Also added the IP of the function app in the DB whitelist just in case (The azure resources can access the DB feature is also on so, adding the IP of the function app is not mandatory I guess) and that didn't work too.

Any support or expertise on the subject matter would be appreciated

Azure SQL Database
Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
5,039 questions
SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
13,883 questions
{count} vote

1 answer

Sort by: Most helpful
  1. Timo Petersen 0 Reputation points
    2024-10-22T13:44:21.02+00:00

    We have the same issue. Restarting the function apps solves the issue. We could automate this, but we prefer a better solution.

    Any suggestions on how to fix this?

    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.