Cause of "can't wait without a PROC structure" - Mailing list pgsql-hackers

From Tom Lane
Subject Cause of "can't wait without a PROC structure"
Date
Msg-id 8126.1032969177@sss.pgh.pa.us
Whole thread Raw
Responses Re: Cause of "can't wait without a PROC structure"  (Scott Shattuck <ss@technicalpursuit.com>)
Re: Cause of "can't wait without a PROC structure"  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I've identified the reason for the occasional "can't wait without a PROC
structure" failures we've seen reported.  I had been thinking that this
must occur during backend startup, before MyProc is initialized ...
but I was mistaken.  Actually, it happens during backend shutdown,
and the reason is that ProcKill (which releases the PGPROC structure
and resets MyProc to NULL) is called before ShutdownBufferPoolAccess.
But the latter tries to acquire the bufmgr LWLock.  If it has to wait,
kaboom.

The ordering of these shutdown hooks is the reverse of the ordering
of the startup initialization of the modules.  It looks like we'll
need to rejigger the startup ordering ... and it also looks like that's
going to be a rather ticklish issue.  (See comments in BaseInit and
InitPostgres.)  Any thoughts on how to do it?
        regards, tom lane


pgsql-hackers by date:

Previous
From: "scott.marlowe"
Date:
Subject: Re: PGXLOG variable worthwhile?
Next
From: Scott Shattuck
Date:
Subject: Re: Cause of "can't wait without a PROC structure"