Re: "stuck spinlock" - Mailing list pgsql-hackers

From Andres Freund
Subject Re: "stuck spinlock"
Date
Msg-id 20131213152442.GL29402@awork2.anarazel.de
Whole thread Raw
In response to Re: "stuck spinlock"  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: "stuck spinlock"
List pgsql-hackers
On 2013-12-13 09:52:06 -0500, Tom Lane wrote:
> Andres Freund <andres@2ndquadrant.com> writes:
> > Tom, could this be caused by c357be2cd9434c70904d871d9b96828b31a50cc5?
> > Specifically the added CHECK_FOR_INTERRUPTS() in handle_sig_alarm()?
> > ISTM nothing is preventing us from jumping out of code holding a
> > spinlock?
> 
> Hm ... what should stop it is that ImmediateInterruptOK wouldn't be
> set while we're messing with any spinlocks.  Except that ProcessInterrupts
> doesn't check that gating condition :-(.

It really can't, right? Otherwise explicit CHECK_FOR_INTERRUPTS()s in
normal code wouldn't do much anymore since ImmediateInterruptOK is so
seldomly set. The control flow around signal handling always drives me
crazy.

> I think you're probably right:
> what should be in the interrupt handler is something like
> "if (ImmediateInterruptOK) CHECK_FOR_INTERRUPTS();"

Yea, that sounds right. Or just don't set process interrupts there, it
doesn't seem to be required for correctness?

Greetings,

Andres Freund

-- Andres Freund                       http://www.2ndQuadrant.com/PostgreSQL Development, 24x7 Support, Training &
Services



pgsql-hackers by date:

Previous
From: Dean Rasheed
Date:
Subject: Re: ruleutils vs. empty targetlists
Next
From: Tom Lane
Date:
Subject: Re: "stuck spinlock"