Recently I came across kinda funny issue. Generally I am working on .NET web app hosted on IIS and using MS SQL server.
Having said that I wrote a simple piece of code to update specific record in db. The record should already exist and no further operations should occur on it (or actually even the entire table) for considerable time (no concurrent operation should appear to overwrite update).
var record = db.InputDataRecords.Where(i => i.Id == inputDataId).Single();
record.InputData = updatedInputData;
db.SaveChangesAsync();
So I wrote the above code, tested it on my local machine, everything worked perfectly fine so I just left it as it was.
Recently the code finally got to the test server (pretty slow sucker) and to my surprise I got info from the test crew that the records do not update accordingly. What is even worse no errors were logged although they should if something went wrong plus I am pretty sure the above code did not throw any errors as, for the sake of peace, I forced it to log message with some details after it is executed (I cannot debug on that machine unfortunately so I couldn't get any better feedback).
I struggled with this issue for couple of hours doing some small adjustments here and there, but nothing was really helping. Finally switching to synchronous SaveChanges()
did the trick.
Did anyone of you come across similar issue? I am pretty curious why it could occur.