Solved : Batched syncing lots of rows over WCF stuck in ApplyChanges RRS feed

  • Question

  • Hello everybody,

    I`m trying to batch sync ca. 80 MB of rows of only one table with no relationships over WCF with SQL Server and a self written sync mechanism. The upload takes long and after that the data changes get applied which takes half an hour. The data is written in the database and after that it hangs in the process. After 4 hours the client closes the connection. If I set the timeout higher it runs forever without complete of the last applyChanges...

    The server-trace says:
    <ExceptionType>System.ServiceModel.CommunicationException, System.ServiceModel, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
    <Message>The network connection was aborted by the local system.</Message>
    at System.ServiceModel.Channels.HttpOutput.ListenerResponseHttpOutput.ListenerResponseOutputStream.Write(Byte[] buffer, Int32 offset, Int32 count)
    at System.ServiceModel.Channels.HttpOutput.Send(TimeSpan timeout)

    Would you please help me, where I can dug deeper to find out the real problem...

    Thanks in advance!


    PS: I forgot to mention that we got a self written secure token server in between...I just fond another message:

    The security timestamp is stale because its expiration time ('2014-05-30T10:01:24.725Z') is in the past. Current time is '2014-05-30T13:44:39.131Z' and allowed clock skew is '00:05:00'.

    But this error emerged at an very very late point...so the error must have happende at an far earlier stage...



    If i set the timeouts to a higher value it hangs in ApplyChanges forever, allthough the data is already bulk inserted  in the target db...

    What could I do to resolve this ?

    Monday, June 2, 2014 11:47 AM

All replies

  • enable Sync Fx tracing to check what's causing the delay in ApplyChanges.

    Wednesday, June 25, 2014 2:16 AM
  • Hi.

    thanks for your answer...I've allready done it...with no usable results. The problem is that with f.e. 4000 rows it works like a charm, but with 400.000 it gets stuck in ApplyChanges forever allthough everything is done and the only thing to do would be the call of EndSession(), what never happens and i don't know why...

    We have already invested more than 100 hours in problem resolution and we are really desperate...

    What else could I do? Any other ideas?
    Wednesday, June 25, 2014 6:46 AM
  • have you checked with SQL Server if its waiting for something? for example, locks.

    what does your Sync Fx tracing show? does it show the ApplyChanges as completed?

    Wednesday, June 25, 2014 8:04 AM

  • We have almost analized and traced everything possible with the only result, that we think that the problem is that all the time the same connection is used but at the last batch the ApplyChanges sends a completed message back to the client on another connection. We don't know why this happens...

    ...is this done on purpose by the sync fx?

    But this seems to be the reason the client never gets out of ApplyChanges :(

    Wednesday, July 2, 2014 8:40 AM
  • Sync Fx doesn't  know anything about WCF.

    am not sure what you mean by message being sent back on another connection. are you using callbacks? 

    Tuesday, July 8, 2014 2:28 AM
  • Solution : We found out that the problem was a setting of the lancom router. TCP-Aging was set to 5 Minutes an the sync process took sometimes 4:58 min an sometimes 5:02. This was the reason that it sometimes worked and sometimes not. Now we are working with a keep-alive which sets us free from the router setting. Hope this helps a lot of people also stuck in this ugly situation...

    Monday, August 25, 2014 7:09 AM