Re: How to handle waitingForLock in LockWaitCancel()

From: Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: How to handle waitingForLock in LockWaitCancel()
Date: 2001-03-09 02:23:58
Message-ID: 3AA83EBE.70AD198E@tpf.co.jp
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I Inoue wrote:
>
> Tom Lane wrote:
> >
> > Hiroshi Inoue <Inoue(at)tpf(dot)co(dot)jp> writes:
> > > [ backtrace snipped ]
> >
> > Hmm, this is definitely not operating as intended: LockWaitCancel is
> > getting interrupted, because ProcessInterrupts may be called when it's
> > trying to acquire the lockmanager spinlock, and ProcessInterrupts will
> > see the ProcDiePending flag already set. I think the correct fix (or
> > at least part of it) is in postgres.c's die():
> >
> > /*
> > * If it's safe to interrupt, and we're waiting for input or a lock,
> > * service the interrupt immediately
> > */
> > if (ImmediateInterruptOK && InterruptHoldoffCount == 0 &&
> > CritSectionCount == 0)
> > {
> > + /* bump holdoff count to make ProcessInterrupts() a no-op */
> > + /* until we are done getting ready for it */
> > + InterruptHoldoffCount++;
> > DisableNotifyInterrupt();
> > /* Make sure HandleDeadLock won't run while shutting down... */
> > LockWaitCancel();
> > + InterruptHoldoffCount--;
> > ProcessInterrupts();
> > }
> >
> > QueryCancelHandler probably needs similar additions.
> >
>
> Agreed. Adding similar code to QueryCancelHandler seems
> sufficient.
>

Is it OK to commit the change before 7.1 release ?
I want to do it before forgetting this issue.
(I've completely forgotten the CheckPoint hang problem
I reported once until I see your report today).

Regards,
Hiroshi Inoue

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pam Withnall 2001-03-09 02:54:40 TOAST
Previous Message Tom Lane 2001-03-09 02:00:09 Re: Internationalized error messages