Re: Hot Standy introduced problem with query cancel behavior

From: Andres Freund <andres(at)anarazel(dot)de>
To: pgsql-hackers(at)postgresql(dot)org
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Simon Riggs <simon(at)2ndquadrant(dot)com>, Joachim Wieland <joe(at)mcknight(dot)de>, Kris Jurka <books(at)ejurka(dot)com>, Fujii Masao <masao(dot)fujii(at)gmail(dot)com>
Subject: Re: Hot Standy introduced problem with query cancel behavior
Date: 2010-01-07 20:03:18
Message-ID: 201001072103.19216.andres@anarazel.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thursday 07 January 2010 19:49:59 Tom Lane wrote:
> Andres Freund <andres(at)anarazel(dot)de> writes:
> > Stupid question:
> >
> > Why dont we add CHECK_FOR_INTERRUPTS (or something similar) to everything
> > calling recv (especially in the EINTR) case?
>
> We pretty much have CHECK_FOR_INTERRUPTS everywhere that it's safe
> already. The problem here is not a lack of execution of
> CHECK_FOR_INTERRUPTS, but what to do inside it. Although I pointed to
> an interrupt service routine as being the worst case, the fact is that
> Simon's code will crash the system in a large number of scenarios even
> when ProcessInterrupts is called from CHECK_FOR_INTERRUPTS rather than
> directly from the signal handler.
I did not want to suggest using Simons code there. Sorry for the brevity.

The reason I suggested adding CHECK_FOR_INTERRUPTS into the recv code path was
that it should allow a relatively "natural" handling of canceling "IDLE IN
TRANSACTION" queries without doing anything in the interrupt handler.

I think it shouldn't be to hard to make that code path safe for
CHECK_FOR_INTERRUPTS().

I personally don't think its important to be that nice to a non-cooperating
backend (i.e. one catching our ERRORs) so I dont see any problems in just
FATAL'ing it after a couple of tries (the code retries already so...).

Andres

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Simon Riggs 2010-01-07 20:05:51 Re: 8.5alpha3 hot standby crash report (DatabasePath related?)
Previous Message Robert Haas 2010-01-07 20:02:33 Re: Serializable Isolation without blocking