Connection closed while committing transaction

Sep 3, 2013 at 7:54 AM
Edited Sep 3, 2013 at 7:55 AM

Thank you very much for your nice framework.

Wanting to use it, was testing it with my own database, and I'm facing a problem.
When I only take a few table in my SQL Server database, everything is fine.
But when I want to sync the whole db (50 tables approx, some of them 150k and more records), I'm not able to sync anything. I have this msg
"The underlying connection was closed: The connection was closed unexpectedly."

Immediately, was suspecting a timeout or messagesize to low from the WCF SyncService.
It seems this is the problem, but I'm not able to configure the Wcf service, as its a autogenerated one, without any config file. I'm using wcf with winrt project, and I know how to configure endpoint and binding configuration programmatically, but no success with the sync service.

Does anyone have the same problem ?
Sep 3, 2013 at 4:56 PM
"The underlying connection was closed: The connection was closed unexpectedly"

In my point of view, this message comes from the server side.
Can you provide me a simple .zip sample, that I can test on my side.

To be honest, I dont have test the Fx on Large database.

Maybe, you can filter rows to retrieve only mandatories rows from server ?

Sep 3, 2013 at 5:35 PM
Wow, thank you very much for so quick answer !

I cannot filter row, because I can't know which data the user will need in this project.

I have this error, and sometime another one "Input string was not in a correct format".

I suspect a problem in parsing the float from SQL Server database in double. I guess it's a sync framework problem, not coming from your toolkit.

I'm trying to check culture but cannot find how to change sync framework culture.

When tracing WCF syncservice, there is no error fired.

Thank for help,

Sep 3, 2013 at 9:31 PM

Some improves in my problems.

It seems it wasn't a buffer problem, but a memory problem.

The trace gave me this :
<ExceptionType>System.InsufficientMemoryException, mscorlib, Version=, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>Impossible d'allouer une mémoire tampon gérée de 268435456 octets. La quantité de mémoire disponible est peut-être faible.</Message>

I've restart SQL Server and then it was ok.

But, I still have this "Input string was not in a correct format" error.

After switching all float fields to int in the SQL Server database, everything is ok.

So, I guess the sync framework is firing error because of different culture.

My dev machine is Windows 8 French OS, so maybe this is why the Double.Parse method called by the sync framework is firing error.

Any idea to force using "fr-FR" culture when converting/parsing things ?
Sep 4, 2013 at 12:41 AM
Hi again,

I've finally managed to correct everything, and I'm sharing here what were wrong.

First of all, even if my dev machine has 8Go of memory, sometimes the wcf syncservice need more to load table in memory.
I just sometimes restart all services (IIS and MSSQL) and everything work fine.

Then, the "Input string was not in a correct format" was because of the different casts you do accross the syncing process.
Best example is in the "ReflectionUtility.cs" file, in the "GetValueFromType" method.
You use "Convert.ChangeType(value, type, null)" method to cast the string value in the correct type, but it will fire exception in different culture than en-US.
Indeed, in my case (fr culture), the "ChangeType" will fail, because here, the decimal separator is "." not ","
I've just added everywhere "CultureInfo.InvariantCulture" as provider for converting value, and now its perfect !!

With your good framework, I'm now able to sync 90mb sqlite databse, very very quickly, and syncing like a charm !!!!

Thank you for your work !!

I hope people using different culture accross the world will use your sync toolit with this trick, as it's the only way to work offline with WinRT (there is only your toolkit on the web)

Have a good day !
Sep 6, 2013 at 3:36 PM
Hi Nicolas;
Can you send me a private message with an email address, so we will be able to see how you have resolve your problem, in depth, and where I need to make an update :)
(By the way, send me your email in french :D )