AlwaysOn-SQL : A connection timeout has occurred on a previously established connection to availability replica

Vijay Reddy 26 Reputation points
2021-06-15T05:22:56.67+00:00

Hello Experts,

AlwaysOn-SQL

We are getting AG time out on SQL2019 after few minutes automatically it is synchronizing inti back.

Error : A connection timeout has occurred on a previously established connection to availability replica.

Can we increase the AG timeout 10 seconds 20 or 30 seconds, is there any impact after changing this ?

Can you share your ideas on this.

Thanks in advance.

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
14,309 questions
{count} votes

2 answers

Sort by: Most helpful
  1. CarrinWu-MSFT 6,886 Reputation points
    2021-06-15T08:55:52.237+00:00

    Hi @Vijay Reddy ,

    Welcome to Microsoft Q&A!

    Can we increase the AG timeout 10 seconds 20 or 30 seconds, is there any impact after changing this ?

    We recommend that you keep the time-out period at 10 seconds or greater. Setting the value to less than 10 seconds creates the possibility of a heavily loaded system missing PINGs and declaring a false failure. Please refer to Modify the session-timeout period for an availability group replica

    By the way, is it in Multi-subnet Availability Group? If yes, please refer to Connection Timeouts in Multi-subnet Availability Group:
    By default, the behavior of the SQL client libraries is to try all IP addresses returned by the DNS lookup - one after another (serially) until the all of the IP addresses have been exhausted and either a connection is made, or a connection timeout threshold has been reached. This can be problematic, because depending upon DNS configurations, the “correct” or “online” IP address may not be the first IP address returned. The default timeout for a TCP connection attempt is 21 seconds and if the first IP address attempted is not online, it will wait 21 seconds before attempting the next IP address. For each subsequent IP address, it will again have to wait 21 seconds before moving to the next IP address until the connection attempt times out or it establishes a connection to an IP address that responds.

    Best regards,
    Carrin


    If the answer is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

  2. Kanchan Rahi 1 Reputation point
    2022-05-26T00:22:12.467+00:00

    Hello @CarrinWu-MSFT ,
    I have seen the same connection time out error msg on my Always on replicas on SQL 2014, 2016 and 2017. Could you please tell me the reason for that error msg? In my case after a minute or 2 min, everything is coming back to normal and able to connect successfully. My replicas are in the same subnet. Please advise, what should I do?

    A connection timeout has occurred on a previously established connection to availability replica 'PRODDB02' with id [----------]. Either a networking or a firewall issue exists or the availability replica has transitioned to the resolving role.

    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.