On azure deployment recieved issue: 'The timeout period elapsed prior to completion of the operation or the server is not responding'

Topics: Transient Fault Handling Application Block ("Topaz")
Dec 10, 2012 at 7:49 AM

We deployed a worker role on azure. This worker role is connected with sql azure database.  In this worker role we have used Microsoft officially recommended approach to handling transient faults i.e 'Transient Fault Handling Application Block' (http://windowsazurecat.com/2011/02/transient-fault-handling-framework/ ) for sql azure connection and operations.  We are recieving following issue in a very frequent basis:

The timeout period elapsed prior to completion of the operation or the server is not responding. contextID is: 0d0e781e-6602-422f-aa05-06b67d7ed4d7

Following are code fragements used in our application

Following is config section: 

 <configSections>
< section name="RetryPolicyConfiguration" type="Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.Configuration.RetryPolicyConfigurationSettings, Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling, Version=5.1.1209.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" requirePermission="true" />
< section name="typeRegistrationProvidersConfiguration" type="Microsoft.Practices.EnterpriseLibrary.Common.Configuration.TypeRegistrationProvidersConfigurationSection, Microsoft.Practices.EnterpriseLibrary.Common, Version=5.0.505.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
< /configSections>
< RetryPolicyConfiguration defaultRetryStrategy="Incremental Retry Strategy">
< incremental name="Incremental Retry Strategy" retryIncrement="00:00:05"
initialInterval="00:00:05" />
< fixedInterval name="Fixed Interval Retry Strategy" retryInterval="00:00:05" />
< exponentialBackoff name="Exponential Backoff Retry Strategy"
minBackoff="00:00:05" />
< /RetryPolicyConfiguration>

 Setup of RetryManager and policy
public static RetryManager retryManager = EnterpriseLibraryContainer.Current.GetInstance<RetryManager>();
public static RetryPolicy retryPolicy = retryManager.GetDefaultSqlConnectionRetryPolicy();

 

connection is opened as follows:

using (ReliableSqlConnection cn = new ReliableSqlConnection(connectionString, retryPolicy))

{

cn.Open()

..............

}

Commands are executed in any of the following fashion:

cmd.ExecuteNonQueryWithRetry(retryPolicy);
retryPolicy.ExecuteAction(() => da.Fill(ds));
cmd.ExecuteReaderWithRetry(retryPolicy);
ExecuteScalarWithRetry(retryPolicy);
cmd.ExecuteXmlReaderWithRetry(retryPolicy);

Can anyone suggest reason of this issue?

 

 

 

Dec 11, 2012 at 3:18 AM

You didn't post StackTrace but I'm guessing you are getting a SqlException with an error Number of -2.  As far as I can tell, the SqlAzureTransientErrorDetectionStrategy does not treat this scenario as being transient.

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com 

Dec 11, 2012 at 5:12 AM

Hi Randy,

 I am not sure what is meaning of SqlException with an error Number of -2. Following is the stack trace of error:

  Error in StartFileCreation. Error Message :Timeout expired.  The timeout period elapsed prior to completion of the operation or the server is not responding.
  StackTrack:    at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
   at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
   at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
   at System.Data.SqlClient.SqlConnection.Open()
   at Microsoft.Practices.TransientFaultHandling.RetryPolicy.<>c__DisplayClass1.<ExecuteAction>b__0()
   at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
   at Microsoft.Practices.TransientFaultHandling.RetryPolicy.<>c__DisplayClass1.<ExecuteAction>b__0()
   at Microsoft.Practices.TransientFaultHandling.RetryPolicy.ExecuteAction[TResult](Func`1 func)
   at Microsoft.Practices.EnterpriseLibrary.WindowsAzure.TransientFaultHandling.SqlAzure.ReliableSqlConnection.Open(RetryPolicy retryPolicy)
   at SyncLibrary.SqlHelper.ExecuteDataset(String connectionString, CommandType commandType, String commandText, Guid& contextID, SqlParameter[] commandParameters) in F:\Garima\One Medical EMR\Project\Cloud\SyncLibrary\SyncLibrary\SQLClasses\FaultToleranceSqlHelper.cs:line 514
 at SyncLibrary.SqlHelper.ExecuteDataset(String connectionString, CommandType commandType, String commandText, Guid& contextID)

Let me know if you can provide me few more hint about the error.

Thanks.

Dec 12, 2012 at 5:36 AM

What type of exception are you seeing?  Based on the stack trace it is probably a SqlException with an error Number of -2.  As far as I can tell, the SqlAzureTransientErrorDetectionStrategy does not treat this scenario as being transient which is why it is not retrying.

You could try upping the connection timeout in the connection string (the default is 15 seconds). 

--
Randy Levy
Enterprise Library support engineer
entlib.support@live.com