self-deadlock at FATAL exit of boostrap process on read error - Mailing list pgsql-hackers

From Qingqing Zhou
Subject self-deadlock at FATAL exit of boostrap process on read error
Date
Msg-id e66cfj$2l8q$1@news.hub.org
Whole thread Raw
Responses Re: self-deadlock at FATAL exit of boostrap process on read error  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I encounter a situation that the server can't shutdown when a boostrap
process does ReadBuffer() but gets an read error. I guess the problem may be
like this - the boostrap process can't read at line:
   smgrread(reln->rd_smgr, blockNum, (char *) bufBlock);

So it does a FATAL exit and shmem_exit() is called:
    while (--on_shmem_exit_index >= 0)     (*on_shmem_exit_list[on_shmem_exit_index].function) (code,
on_shmem_exit_list[on_shmem_exit_index].arg);
Where   on_shmem_exit_list[0] = DummyProcKill   on_shmem_exit_list[1] = AtProcExit_Buffers

The above callback is called in a stack order, so AtProcExit_Buffers() will
call AbortBufferIO() which is blocked by itself on "io_in_progress_lock"
(which is not the case as the comment says "since LWLockReleaseAll has
already been called, we're not holding the buffer's io_in_progress_lock").

There may other similar problems for bootstrap process like this, so I am
not sure the best fix for this ...

Regards,
Qingqing




pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Compression and on-disk sorting
Next
From: Zdenek Kotala
Date:
Subject: Re: How to avoid transaction ID wrap