none
WCF Sync with proxy - channel closed after GetChanges on server side if data is not batched RRS feed

  • Question

  • Hello!
    I have a sync application of two Oracle databases using WCF to synchronize over the network. My example is based on the sample provided with Microsoft Sync Framework SDK (WebSharingAppDemo-CEProviderEndToEnd). I use it to synchronize two Oracle databases (I created my own classes to create DB scripts that perform provisioning, etc.).
    The application is an win forms application that starts up at client side. I have a class that extends from DbSyncProvider, and when the SyncOrchestrator calls its methods I call WCF proxy methods, that does sync process at the server side.

    I setup the sync process to be batched, because I have a large amount of data to be synchronized. The sync process works in the initial state, when I download all the changes form the server to the client. Then, when I want to sync again (supposedly there is no more data on the server to retrieve), when I call GetChanges on the proxy, the peer provider at the server side gets teh empty ChangeBatch(no errors), but when it returns the change batch to the caller (my win forms app), the WCF channel gets closed.

    I have eliminated serialize/deserialize problems,  also no errors when the sync provider is selecting the changes. AT first I thought that the error was because the change batch was empty, but after the inital sync, I've inserted a row or two into the server db, and when is getting changes, it gets them, returns the change batch containing those changes, but the problem still persist(the channel still gets closed), wich lead me to think that when it is not batched, raises the issue. There is no other error that can give me a clue ( I use error tracing for the WCF service, and the only things it logs is that the channel is closed/ thread was aborted).

    Also, curiously, this thing is happening only when I host the WCF service in IIS 6. When I use the WCF service as a self-hosted application, the problem does not happen.

    The code is much to long to post here, If someone needs to see it I can post parts of it.
    Monday, February 1, 2010 3:54 PM

Answers

All replies

  • I come with an update.

    Apparently, when I set MemoryDataCacheSize to 0, it doesn't close the channel anymore.
    The only time the "error" rises is when have MemoryDataCacheSize set to a value, and the amount of changes doesn't exceed the limit so the data is not batched, actually.

    Are there any known issue for this matter? Does anyone know what the provider does "behind the scenes" when this case appears? Does it throw any hidden error or does it try to write to some file or anything? Because it is happening only in IIS 6, where NETWORK SERVICE user comes in and it doesn't have many privilegies?

    Thanks!
    Monday, February 1, 2010 4:56 PM
  • Phazzy,

    Where are you putting the temporary generated batch files. If you are putting them in the IIS directory, then there is a know issue that IIS refreshed the service depending on certain criteria at which point the channel can get closed.
    Try pointing to a different location on the hard disk for the generated batch files and see if you still have the issue.
    This posting is provided AS IS with no warranties, and confers no rights
    Sunday, February 7, 2010 11:40 PM
  • Thanks for the answer,

    I don't think this is the issue. As I said, the only time the channel gets closed is when I set a batch memory size but the changes are not batched because the size of the changes is less than the batch size. In this scenario, no batch files are being spooled to the disk.

    I will investigate this further. For now I host the WCF service in an application (self hosted). With this approach I have another very big issue regarding communication over Internet , I posted a Thread about it.

    Thanks again
    Thursday, February 11, 2010 7:28 AM
  • What is the exception you are seeing? Maybe a call stack may help us look further.
    Also if you can gather the IIS traces and see if there anything weird there and share those out, that would be helpful too.
    This posting is provided AS IS with no warranties, and confers no rights
    Friday, February 12, 2010 6:36 AM
  • I'm experiencing exactly the same problem. The application hangs and batch syncing stops immediately after GetKnowledge(), which according to the WCF trace file completes succesfully. The problem occurs when the sync direction is upload. Sync with Download only works fine.

    I am uploading over WCF hosted in IIS7 using SqlCeSyncProvider and a proxy to SqlSyncProvider.

    Below are the IIS log file records:

    #Software: Microsoft Internet Information Services 7.5
    #Version: 1.0
    #Date: 2010-02-17 05:43:41
    #Fields: date time s-ip cs-method cs-uri-stem cs-uri-query s-port cs-username c-ip cs(User-Agent) sc-status sc-substatus sc-win32-status time-taken
    2010-02-17 23:59:59 fe80::6de9:27ae:8c35:8c7c%11 POST /SIBI.Sync/ServerSync2.svc - 80 - fe80::3076:adc3:ac90:90ee%11 - 200 0 0 3806
    2010-02-17 23:59:59 fe80::6de9:27ae:8c35:8c7c%11 POST /SIBI.Sync/ServerSync2.svc - 80 - fe80::3076:adc3:ac90:90ee%11 - 200 0 0 4
    2010-02-17 23:59:59 fe80::6de9:27ae:8c35:8c7c%11 POST /SIBI.Sync/ServerSync2.svc - 80 - fe80::3076:adc3:ac90:90ee%11 - 200 0 0 12
    2010-02-17 23:59:59 fe80::6de9:27ae:8c35:8c7c%11 POST /SIBI.Sync/ServerSync2.svc - 80 - fe80::3076:adc3:ac90:90ee%11 - 200 0 0 5
    2010-02-17 23:59:59 fe80::6de9:27ae:8c35:8c7c%11 POST /SIBI.Sync/ServerSync2.svc - 80 - fe80::3076:adc3:ac90:90ee%11 - 200 0 0 163
    2010-02-17 23:59:59 fe80::6de9:27ae:8c35:8c7c%11 POST /SIBI.Sync/ServerSync2.svc - 80 - fe80::3076:adc3:ac90:90ee%11 - 200 0 0 313
    2010-02-17 23:59:59 fe80::6de9:27ae:8c35:8c7c%11 POST /SIBI.Sync/ServerSync2.svc - 80 - fe80::3076:adc3:ac90:90ee%11 - 200 0 0 225
    Wednesday, February 17, 2010 1:37 AM
  • Solved it myself. Was calling GetChangeBatch twice in an override. On the second call this method just hung.

    Wednesday, February 17, 2010 7:00 AM
  • Hi ArcSend, thanks for providing this info. I am just curoius, any reason the GetChangeBatch got called twice, is this just a accident/mistake in the proxy code ?

    thanks
    Yunwen
    This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, February 17, 2010 8:23 AM
    Moderator
  • Phazzy, I was experiencing the exact same issue.  Turns out it was all related to the batching directory.  I had it set to a spot under the root of the web application.  I moved it outside and the problem went away.

    Thanks Mahesh for the pointer! 

    Stewart

    Wednesday, March 17, 2010 6:52 PM