locked
WCF + SqlServer 2008 + SqlServer CE + NetTcpBinding using code from DatabaseSyncP2PoverWCF Sample RRS feed

  • Question

  • I get a wild error and cant find out where it's from. I got the code from the WCF sample DatabaseSyncP2PoverWCF. I merged this into my code and all works well with 2 tables. No problems. When I added all 162 tables to my DbSyncScopeDescription I get the error below. This error is getting caught on the client side. The server side seems to return the info fine.

    It's almost like the more tables I add it throws this error. And even though the source says Microsoft.Synchronization the SyncException doesnt catch it.

    Any thoughts?

    [12:06:25 PM] PXCloudServer - CloudNode Request for PXSCloudServer.Initialize...
    [12:06:25 PM] PXCloudNode - =============> Sync Start: 12:06:25 PM
    [12:06:26 PM] PXCloudServer - CloudNode Request for PXSCloudServer.BeginSession...
    [12:06:26 PM] PXCloudServer - *****************************************************************
    [12:06:26 PM] PXCloudServer - ******************** New Sync Session ***************************
    [12:06:27 PM] PXCloudServer - *****************************************************************
    [12:06:27 PM] PXCloudServer - BeginSession: ScopeName: pxs_all_7, Position: Remote
    [12:06:28 PM] PXCloudServer - CloudNode Request for PXSCloudServer.GetKnowledge...
    [12:06:28 PM] PXCloudServer - GetSyncBatchParameters: Data Source=RHENDERSON_PXS;Initial Catalog=CloudStorage_002003____KAYAK;Persist Security Info=True;User ID=xx;Password=xx
    [12:06:30 PM] PXCloudNode - Synchronize Error: The communication object, System.ServiceModel.Channels.ServiceChannel, cannot be used for communication because it is in the Faulted state.
    [12:06:30 PM] PXCloudNode - Synchronize Error Source: Microsoft.Synchronization
    [12:06:30 PM] PXCloudNode - Synchronize Error TargetSite: Void Start(CONFLICT_RESOLUTION_POLICY, _SYNC_SESSION_STATISTICS ByRef)

    [12:06:30 PM] PXCloudNode - Synchronize Error StackTrace:
    Server stack trace:
       at System.ServiceModel.Channels.CommunicationObject.ThrowIfDisposedOrNotOpen()
       at System.ServiceModel.Channels.ServiceChannel.EnsureOpened(TimeSpan timeout)
       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 PXS.CloudContract.IPXSCloudStorageSync.EndSession()
       at PXS.CloudContract.PXSCloudStorageSyncProviderProxy.EndSession(SyncSessionContext syncSessionContext) in C:\PlatinumXunSolutions\PXS\PXS.CloudContract\PXSCloudStorageSyncProviderProxy.cs:line 66
       at Microsoft.Synchronization.KnowledgeProviderProxy.EndSession(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 PXS.CloudNode.CloudNodeAgent.Sync() in C:\PlatinumXunSolutions\PXS\PXS.CloudNode\CloudNodeAgent.cs:line 185
    • Moved by Max Wang_1983 Thursday, April 21, 2011 10:45 PM forum consolidation (From:SyncFx - Microsoft Sync Framework Database Providers [ReadOnly])
    Monday, November 2, 2009 5:42 PM

Answers

  • Hi,

    With the new information that you just added, I suspect more in WCF timeout settings. Please try to increase the values of closeTimeout, openTimeout, receiveTimeout, sendtimeout and maxreceivedMessageSize in your binding setting. You can look at this post for what these timeouts are for: http://social.msdn.microsoft.com/forums/en-US/wcf/thread/84551e45-19a2-4d0d-bcc0-516a4041943d/ (You may not need to increase all of them if you know which ones cause the problem). The default values are not enough for your scenarios.

    Thanks,
    Dong

    This posting is provided AS IS with no warranties, and confers no rights.
    Monday, November 2, 2009 10:52 PM
    Moderator

All replies

  • Hi,

    It seems that the WCF service side either timeout or failed by exception. Please enable tracing on WCF service to see what is wrong. Also, it may take a lot of time to sync 162 tables in a sync session. The default WCF timeout settings may not be enough. Please consider increasing them. I will try to incrementally add more tables and check the WCF service trace logs to narrow down the issue.

    Thanks,
    Dong
    This posting is provided AS IS with no warranties, and confers no rights.
    Monday, November 2, 2009 6:51 PM
    Moderator
  • Something else I just tested out. I narrowed the scope down to 30 tables and it still failed so I started thinking that maybe there's something wrong with a particular table but when I grouped those same tables together in smaller scope groups the error never showed. So this means that nothing was wrong with any of the tables.

    I've got the mem cache size set to 0 so that it's not batched. I've also tried it will all sorts of other numbers like 5, 50, 500, 5000, but nothing.

    providerCE.MemoryDataCacheSize = 0;

    Something else I noticed is that when it tries to sync it fails and then tries to end the session but the connection was already closed for some reason. I get this from the SyncSessionContext

    public override void EndSession(SyncSessionContext syncSessionContext)

    "An existing connection was forcibly closed by the remote host"

    I have no idea what goes on inside of Orchestrator.Synchronize() method but this is where it's failing.

    SyncOperationStatistics stats = orchestrator.Synchronize();
    Monday, November 2, 2009 6:59 PM
  • Hi,

    With the new information that you just added, I suspect more in WCF timeout settings. Please try to increase the values of closeTimeout, openTimeout, receiveTimeout, sendtimeout and maxreceivedMessageSize in your binding setting. You can look at this post for what these timeouts are for: http://social.msdn.microsoft.com/forums/en-US/wcf/thread/84551e45-19a2-4d0d-bcc0-516a4041943d/ (You may not need to increase all of them if you know which ones cause the problem). The default values are not enough for your scenarios.

    Thanks,
    Dong

    This posting is provided AS IS with no warranties, and confers no rights.
    Monday, November 2, 2009 10:52 PM
    Moderator
  • DONG CAO YOU ARE THE MAN!!!!! Thanks dude!!!!

    MaxReceivedMessageSize was the culprit. I had this set on the client side but didnt have it set on server side. Good to go now. It sync'd all 162 tables in 12 seconds. Of course, the tables didnt have any data but this same process took close to 15 minutes with the older versions of the Sync Framework. You guys have done a great job on performance enhancements.

    Tuesday, November 3, 2009 12:20 AM