"Qingqing Zhou" <zhouqq@cs.toronto.edu> writes:
> I guess the problem is here:
> /*
> * Fix the process wait semaphore's count for any absorbed wakeups.
> */
> while (extraWaits-- > 0)
> PGSemaphoreUnlock(&proc->sem);
Mmm. Could be a problem, but the chances of having extraWaits>0 is
really pretty small. In any case, FATAL doesn't fix this, because
it will still try to go through normal backend exit cleanup which
requires having working LWLock support. If you take the above risk
seriously then you need a PANIC error.
The alternative would be to move the Unlock loop in front of the
addition of the LWLock to held_lwlocks[], but I think that cure
is probably worse than the disease --- the chance of an error during
Unlock seems nonzero.
regards, tom lane