Thread: undetected deadlock

undetected deadlock

From
"Joseph Artsimovich"
Date:
Hi,

I had a problem in my program (used the wrong mode for locking),
which caused undetected deadlocks. When I tried to reproduce the
problem, I did the following:
1. Create the test table and insert some rows there.
2. Start 2 psql sessions.
3. Execute "begin; lock table test in share mode;" in each session.
4. Execute "update test set data='something'" in each session.
On step 4 (1st session) I've got an undetected deadlock. The
processes' states were "idle waiting" and "idle in transatcion". The
most interesting thing is that I've done the same test before, and
then the deadlock was detected on step 4 (2nd session). Restarting
postgres does not change anything, the deadlock is still not
detected.
I use Postgresql 7.1.3 on RedHat 7.1.

My original problematic program can be downloaded from here:
http://www.dkd.lt/~joseph/test.tar.gz
It's a database session handler written in php. To trigger the
problem, run:
ab -n 100 -c 10 http://yourhost/path_to_the_program/index.php