GDataDB icon indicating copy to clipboard operation
GDataDB copied to clipboard

The remote server returned an error: (412) Precondition Failed.

Open pietergent opened this issue 10 years ago • 5 comments

Hi, 0.6 it seems to work in most cases, but for some rows I receive this error when doing an update: "The remote server returned an error: (412) Precondition Failed.". No clue yet why I receive this error for some rows and not for others :-/

System.Net.WebException was unhandled HResult=-2146233079 Message=The remote server returned an error: (412) Precondition Failed. Source=System StackTrace: at System.Net.WebClient.UploadDataInternal(Uri address, String method, Byte[] data, WebRequest& request) at System.Net.WebClient.UploadString(Uri address, String method, String data) at GDataDB.Impl.Row`1.Update() in c:\prg\GDataDB\GDataDB\GDataDB\Impl\Row.cs:line 24

pietergent avatar Aug 15 '15 12:08 pietergent

Can you post a failing test?

mausch avatar Aug 15 '15 18:08 mausch

I found out in the meantime what caused the problem. These are all rows that are updated twice without refreshing the GDataDB.ITable in the meantime. So kind of sounds logic to me that it cannot update the row anymore as it does not contain the original values anymore?

pietergent avatar Aug 16 '15 14:08 pietergent

You mean you have multiple concurrent writers? Or does even a simple row.Update(); row.Update(); fail?

mausch avatar Aug 17 '15 21:08 mausch

Not Multiple concurrent writers, but 2 times an update. It can be reproduced in your sample code. In Program.cs, replace

            r.Element.Conteudo = "nothing at all";
            Console.WriteLine("updating row");
            r.Update();

with

            r.Element.Conteudo = "nothing at all";
            Console.WriteLine("updating row");
            r.Update();
            r.Element.Conteudo = "nothing at all again";
            Console.WriteLine("updating row again");
            r.Update();

(where the 5th and 6th line are not even needed to reproduce it)

pietergent avatar Aug 17 '15 21:08 pietergent

My guess is we need to change the row's etag with the response of each update. Could you check that?

mausch avatar Aug 18 '15 00:08 mausch