Wednesday, February 09, 2005

SQL Server, why do you block me?

Our tester complaint that our latest client server application hang. It happens if more than one user access the same record, ex. UserA and UserB. Once userA lookup record1, modify it and then save it. UserB will not able to access the same record anymore unless UserA exit from his application.

After some observation, we found that UserA process locked record1 and UserB is waiting for it. Since we use the default lock_timeout (wait infinite), so no error returned.

The application is written using VFP8 SP1, remote view with optimistic table buffering, automatic trasaction. We can't see anything could cause this problem. By using SQL Server Enterprise, we figure out the table and key being locked. After some trial and error, we able to solve it finally. However, we still not sure why!

The cause of problem is, we tried to requery the remote view in form.refresh(). In fact, this remote is not used during refresh but only useful in post save event. We moved out the requery code from form.refresh to post save event then it works fine.

Of course, what we did is not a good programming practise. But, why it could happen?

From forum, some members mentioned that using remote view with table buffering would cause such problem. I couldn't find any related info from VFP help and also Client-Server Applications with Visual FoxPro and SQL Server 7.0.

Any advise?

0 Comments:

Post a Comment

<< Home