locked
WebSharing SQL End2End: FaultException'1 The creator of this fault did not specify a Reason. RRS feed

  • Question

  • Hi,

    Were giving the WebSharing SQL End2End demo a try and running into a problem once we step up the amount of changes and enable batching. For this test we inserted 8k new records into order_details and set the batch size at 1000 kb. Were not having much luck figuring this one out so I was hoping someone here might have run across this and could shed some light on it.

    The error we are getting is:

    A first chance exception of type 'System.ServiceModel.FaultException`1' occurred in WebSyncContract.exe. The creator of this fault did not specify a Reason.

    Here is the end of the sync trace:

    VERBOSE, SyncApplication, 5, 03/18/2010 13:31:51:889,       RelationalSyncProvider.BatchedEnum: Memory data cache size after reading row: 218166 Bytes
    VERBOSE, SyncApplication, 5, 03/18/2010 13:31:51:889,       Insert for row with PK: order_details_id = 9020 on peer1
    VERBOSE, SyncApplication, 5, 03/18/2010 13:31:51:889,          UV: 0,7037 CV: 0,7037
    VERBOSE, SyncApplication, 5, 03/18/2010 13:31:51:889,       RelationalSyncProvider.BatchedEnum: Memory data cache size after reading row: 218315 Bytes
    INFO   , SyncApplication, 5, 03/18/2010 13:31:51:889,    RelationalSyncProvider.BatchedEnum: --- End Table "order_details" ---
    INFO   , SyncApplication, 5, 03/18/2010 13:31:51:889, 
    VERBOSE, SyncApplication, 5, 03/18/2010 13:31:51:889,       RelationalSyncProvider.BatchedEnum: Closing DataReader
    INFO   , SyncApplication, 5, 03/18/2010 13:31:51:889,       RelationalSyncProvider.BatchedEnum: Finished enumerating adapter order_details
    INFO   , SyncApplication, 5, 03/18/2010 13:31:51:889,       RelationalSyncProvider.BatchedEnum: Adding rows enumerated for adapter order_details to DataSet.
    VERBOSE, SyncApplication, 5, 03/18/2010 13:31:51:904,       SyncBatchProducer: Read last row's Sync_row_timestamp value for table order_details as 7037.
    INFO   , SyncApplication, 5, 03/18/2010 13:31:51:904,       RelationalSyncProvider.BatchedEnum: Finished enumerating all adapters.
    INFO   , SyncApplication, 5, 03/18/2010 13:31:51:904,       RelationalSyncProvider.BatchedEnum: Adding non batched rows as the last batch. Last batch data size 218315 Bytes
    VERBOSE, SyncApplication, 5, 03/18/2010 13:31:51:904,       SyncBatchProducer: Enqueuing Batch. Batch Details: 
    		Version                   :3.1
    		BatchId                   :1237e58f-3978-4c30-b920-2703ac0f0781
    		Batch Number              :2
    		Is Last Batch             :True
    		Data Cache Size           :218315
    		Table Watermarks          :[orders,3004],[order_details,7037],
    INFO   , SyncApplication, 5, 03/18/2010 13:31:51:920,       SyncBatchProducer: Enqueuing Batch. Total Batches Enqueued: 2. Details: 
    		Version                   :3.1
    		BatchId                   :1237e58f-3978-4c30-b920-2703ac0f0781
    		Batch Number              :2
    		Is Last Batch             :True
    		Data Cache Size           :218315
    		Table Watermarks          :[orders,3004],[order_details,7037],
    VERBOSE, SyncApplication, 5, 03/18/2010 13:31:51:920,       SyncBatchProducer: Enqueuing DbBatchSpooled event.
    INFO   , SyncApplication, 5, 03/18/2010 13:31:51:920,       SyncBatchProducer: Signalling Queue availability event. Queue Count: 1
    INFO   , SyncApplication, 5, 03/18/2010 13:31:51:920,       RelationalSyncProvider.BatchedEnum: Setting BgdEnumInProcess to false, BgdEnumCompleted to True and setting Cancellation event.
    The thread 0x1828 has exited with code 0 (0x0).
    'WcfSvcHost.exe' (Managed): Loaded 'C:\WINDOWS\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll'
    A first chance exception of type 'System.ServiceModel.FaultException`1' occurred in WebSyncContract.exe
    Thanks
    * Note: I have no formal CS education, so take all advice with caution :)
    Thursday, March 18, 2010 1:45 PM

Answers

All replies

  • Also the debugger is stopping on the line dataRetriever.BatchFileName = localBatchFileName:

            public SyncSessionStatistics ApplyChanges(ConflictResolutionPolicy resolutionPolicy, ChangeBatch sourceChanges, object changeData)
            {
                Log("ProcessChangeBatch: {0}", this.peerProvider.Connection.ConnectionString);
    
                DbSyncContext dataRetriever = changeData as DbSyncContext;
    
                if (dataRetriever != null && dataRetriever.IsDataBatched)
                {
                    string remotePeerId = dataRetriever.MadeWithKnowledge.ReplicaId.ToString();
                    //Data is batched. The client should have uploaded this file to us prior to calling ApplyChanges.
                    //So look for it.
                    //The Id would be the DbSyncContext.BatchFileName which is just the batch file name without the complete path
                    string localBatchFileName = null;
                    if (!this.batchIdToFileMapper.TryGetValue(dataRetriever.BatchFileName, out localBatchFileName))
                    {
                        //Service has not received this file. Throw exception
                        throw new FaultException<WebSyncFaultException>(new WebSyncFaultException("No batch file uploaded for id " + dataRetriever.BatchFileName, null));
                    }
                    dataRetriever.BatchFileName = localBatchFileName;
                }
    
                SyncSessionStatistics sessionStatistics = new SyncSessionStatistics();
                this.peerProvider.ProcessChangeBatch(resolutionPolicy, sourceChanges, changeData, new SyncCallbacks(), sessionStatistics);
                return sessionStatistics;
            }

    * Note: I have no formal CS education, so take all advice with caution :)
    Thursday, March 18, 2010 1:47 PM
  • try changing the batch spooling directory.

    Thursday, March 18, 2010 1:55 PM
  • Thats actually the first thing I did :)

    I changed it to something right on the C: drive but still the same problem.
    * Note: I have no formal CS education, so take all advice with caution :)
    Thursday, March 18, 2010 2:03 PM
  • Starting to get a little bit closer. The initial code is definately setting the SqlSyncProvider.BatchingDirectory but somewhere after that it is getting switched to a temp folder in my user folder.
    * Note: I have no formal CS education, so take all advice with caution :)
    Thursday, March 18, 2010 2:24 PM
  • The default directory for the provider is the temp folder under your user. Are you creating the provider somewhere else that does not have the directory explicitly set?
    Thursday, March 18, 2010 4:26 PM
  • Hi,

    Please remove IsOneWay=true setting from IRelationalSyncContract.UploadBatchFile. More explanation can be found in my reply of another thread: http://social.msdn.microsoft.com/Forums/en-US/syncdevdiscussions/thread/56ca2fb6-1cb2-44d8-8619-1c3d6e6442b5

    Thanks,
    Dong


    This posting is provided AS IS with no warranties, and confers no rights.
    Thursday, March 18, 2010 4:49 PM
  • Thank you Dong, that did indeed fix the problem. Now I am running into another but this may be a showstopper. After the initial sync I am going into the Peer2 database (the database that sits behind the web service) and inserting a few thousand records. Then I am resyncing. This works fine until I turn on batching (specify a batch size). The error I am getting is:

    {"An unexpected error occurred when applying batch file C:\\TempBatchTest\\WebSync_51808162eff54445a557e109b5807bb1\\bbc04f5f-a32c-4498-b9bf-2bfe390d3306.batch. See the inner exception for more details."}

    {"Attempting to deserialize an empty stream."}

    (I noticed the .batch files are empty as well)

    I wonder if this is a bug or just the fact that you cannot batch the upload. In our case the majority of large transfers are going to be coming from the webservice to the client.

    This is a different issue so I will create a new post.
     
    * Note: I have no formal CS education, so take all advice with caution :)
    Thursday, March 18, 2010 5:59 PM