http://qs321.pair.com?node_id=862450


in reply to Re: avoiding a race (read locks)
in thread avoiding a race

Thanks for the reply.

If I understand you correctly, isnt there still a potential for a race condition ?

If the database goes down and all 300 procs get a db error.

process 123 open file and places a shared lock

process 321 opens file and places a shared lock

process 123 decides it is going to modify the file and so waits for 123 to unlock then places an exclusive lock modifies file and closes

process 321 decides it is going to modify the file and so places an exclusive lock modifies file and closes.

If both are changing the file as a result of the same error (i.e database is down) you will get 2 of the same error codes recorded. and 2 emails sent to admins .

thanks.