locked
Timeout bug: CommandTimeout of ReadSyncSchemaInfo is never set RRS feed

  • Question

  • Hello,

    Our system sychronises databasea across many different machines in many different geographical locations. On a single machine, i am consistently getting

     Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception: The wait operation timed out
     --- End of inner exception stack trace ---
     at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
     at System.Data.SqlClient.TdsParserStateObject.ReadSniError(TdsParserStateObject stateObj, UInt32 error)
     at System.Data.SqlClient.TdsParserStateObject.ReadSniSyncOverAsync()
     at System.Data.SqlClient.TdsParserStateObject.TryReadNetworkPacket()
     at System.Data.SqlClient.TdsParserStateObject.TryPrepareBuffer()
     at System.Data.SqlClient.TdsParserStateObject.TryReadByte(Byte& value)
     at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
     at System.Data.SqlClient.SqlDataReader.TryConsumeMetaData()
     at System.Data.SqlClient.SqlDataReader.get_MetaData()
     at System.Data.SqlClient.SqlCommand.FinishExecuteReader(SqlDataReader ds, RunBehavior runBehavior, String resetOptionsString)
     at System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, SqlDataReader ds)
     at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method, TaskCompletionSource`1 completion, Int32 timeout, Task& task, Boolean asyncWrite)
     at System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
     at System.Data.SqlClient.SqlCommand.ExecuteScalar()
     at Microsoft.Synchronization.Data.SyncUtil.TryOpenConnection(IDbConnection connection)
     at Microsoft.Synchronization.Data.SyncUtil.OpenConnection(IDbConnection connection)
     at Microsoft.Synchronization.Data.SqlServer.SqlSyncSchemaInfoHandler.ReadSyncSchemaInfo(IDbConnection connection, IDbTransaction transaction, String objectPrefix, String objectSchema)
     at Microsoft.Synchronization.Data.SyncSchemaInfoHandlerBase.ReadSyncSchemaInfo(IDbConnection connection, String objectPrefix, String objectSchema)
     at Microsoft.Synchronization.Data.SqlServer.SqlManagementUtils.GetSyncSchemaInfo(IDbConnection connection, IDbTransaction trans, String objectPrefix, String objectSchema)
     at Microsoft.Synchronization.Data.SqlServer.SqlManagementUtils.VerifyRuntimeVersionExceedsSchema(SqlConnection connection, String objectPrefix, String objectSchema, Boolean throwWhenNotProvisioned)
     at Microsoft.Synchronization.Data.SqlServer.SqlSyncProvider.Configure()
     at Microsoft.Synchronization.Data.SqlServer.SqlSyncProvider.BeginSession(SyncProviderPosition position, SyncSessionContext syncSessionContext)
     at Microsoft.Synchronization.KnowledgeProviderProxy.BeginSession(SYNC_PROVIDER_ROLE providerRole, ISyncSessionState pSessionState)
     at Microsoft.Synchronization.CoreInterop.ISyncSession.Start(CONFLICT_RESOLUTION_POLICY resolutionPolicy, _SYNC_SESSION_STATISTICS& pSyncSessionStatistics)
     at Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWaySyncHelper(SyncIdFormatGroup sourceIdFormats, SyncIdFormatGroup destinationIdFormats, KnowledgeSyncProviderConfiguration destinationConfiguration, SyncCallbacks DestinationCallbacks, ISyncProvider sourceProxy, ISyncProvider destinationProxy, ChangeDataAdapter callbackChangeDataAdapter, SyncDataConverter conflictDataConverter, Int32& changesApplied, Int32& changesFailed)
     at Microsoft.Synchronization.KnowledgeSyncOrchestrator.DoOneWayKnowledgeSync(SyncDataConverter sourceConverter, SyncDataConverter destinationConverter, SyncProvider sourceProvider, SyncProvider destinationProvider, Int32& changesApplied, Int32& changesFailed)
     at Microsoft.Synchronization.KnowledgeSyncOrchestrator.Synchronize()
     at Microsoft.Synchronization.SyncOrchestrator.Synchronize()
     at integration point

    decompiling the offending method;

     protected override SyncSchemaInfo ReadSyncSchemaInfo(IDbConnection connection, IDbTransaction transaction, string objectPrefix, string objectSchema)

    we can see that the CommandTimeout for this operation is never set.

                command = connection.CreateCommand();
                command.CommandText = this.SelectSchemaInfoCommand.CommandText;
                command.Transaction = transaction;
                SyncTracer.Verbose("Reading Schema Version Info");
                SyncTracer.TraceCommandAndParameters(command);
                dataReader = command.ExecuteReader();

    It should actually be set by the provider, based on the commandtimeout property. What are my options to work around this transient fault if i cant control the connection speed of the offending computer?


    Monday, March 23, 2015 2:30 AM

All replies

  • not much option other than to retry. as you have mentioned this one doesn't seem to inherit the command timeout set on the provider. 
    Monday, April 13, 2015 8:08 AM