locked
open DataReader associated with this Command must be closed first message on sync RRS feed

  • Question

  • Hi all,

    I need some help to solve this error occurring sometimes when sync server and client databases.

    The server db is mssql 2005, the client db is sqlite.

    The exception from the server side is:

    System.InvalidOperationException was caught
      Message="There is already an open DataReader associated with this Command which must be closed first."
      Source="System.Data"
      StackTrace:
           at System.Data.SqlClient.SqlInternalConnectionTds.ValidateConnectionForExecute(SqlCommand command)
           at System.Data.SqlClient.SqlConnection.ValidateConnectionForExecute(String method, SqlCommand command)
           at System.Data.SqlClient.SqlCommand.ValidateCommand(String method, Boolean async)
           at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(DbAsyncResult result, String methodName, Boolean sendToPipe)
           at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()
           at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.GetNewServerAnchor(SyncGroupMetadata groupMetadata, SyncSession session)
           at Microsoft.Synchronization.Data.Server.DbServerSyncProvider.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
           at ShellServices.SyncServices.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)


    from the client side is the following:

    System.Reflection.TargetInvocationException was caught
      Message="Exception has been thrown by the target of an invocation."
      Source="mscorlib"
      StackTrace:
           at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
           at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
           at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
           at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
           at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
           at Microsoft.Synchronization.Data.ServerSyncProviderProxy.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)
           at Microsoft.Synchronization.SyncAgent.DownloadChanges(SyncGroupMetadata groupMetadata)
           at Microsoft.Synchronization.SyncAgent.Synchronize()
           at TaskFlow.SynchronizationController.Synchronize()
      InnerException: System.ServiceModel.FaultException<System.ServiceModel.ExceptionDetail>
           Message="There is already an open DataReader associated with this Command which must be closed first."
           Source="mscorlib"
           Action="http://schemas.microsoft.com/net/2005/12/windowscommunicationfoundation/dispatcher/fault"
           StackTrace:
             Server stack trace:
                at System.ServiceModel.Channels.ServiceChannel.ThrowIfFaultUnderstood(Message reply, MessageFault fault, String action, MessageVersion version, FaultConverter faultConverter)
                at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)
                at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
                at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs)
                at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
                at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
             Exception rethrown at [0]:
                at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
                at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
                at IShellServices.ISyncServices.GetChanges(SyncGroupMetadata groupMetadata, SyncSession syncSession)


    I have noticed that this error is thrown when having a big size server db (around 180 MB) and when 2 clients trying simultaneously to sync with the server db.
    • Moved by Hengzhe Li Friday, April 22, 2011 5:28 AM (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Tuesday, March 3, 2009 2:15 PM