Re: possible bug not in open items

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: Bruce Momjian <bruce(at)momjian(dot)us>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: possible bug not in open items
Date: 2009-03-27 19:26:15
Message-ID: 49CD2857.8010508@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Jeff Davis wrote:
> The docs say:
>
> "SIGINT -- The server disallows new connections and sends all existing
> server processes SIGTERM, which will cause them to abort their current
> transactions and exit promptly."
>
> http://www.postgresql.org/docs/8.3/static/server-shutdown.html
>
> If you have an open COPY and no data is moving, it simply won't
> terminate it. You can terminate it with ctrl-C from psql, but not a
> SIGINT to the postmaster or a SIGINT or SIGTERM to the backend.

I actually started to looked at this when you posted, but was pre-empted
with something else. Looking at the code, there's comments that actually
use COPY FROM STDIN as an example of things that should not be
interrupted by signals:

> /*
> * (2) Allow asynchronous signals to be executed immediately if they
> * come in while we are waiting for client input. (This must be
> * conditional since we don't want, say, reads on behalf of COPY FROM
> * STDIN doing the same thing.)
> */
> QueryCancelPending = false; /* forget any earlier CANCEL signal */
> DoingCommandRead = true;
>
> /*
> * (3) read a command (loop blocks here)
> */
> firstchar = ReadCommand(&input_message);

But in light of your bug report, that doesn't seem quite right. We don't
want to enable notify or catchup interrupts during COPY FROM, but we
should react to fast shutdown and query cancel.

I'm not too familiar with this code, but I think we could just enable
ImmediateInterruptOK in CopyGetData().

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Heikki Linnakangas 2009-03-27 19:35:53 Re: possible bug not in open items
Previous Message Jeff Davis 2009-03-27 16:49:22 Re: possible bug not in open items