Re: How to cancel a query if SIGINT does not work? - Mailing list pgsql-general

From Tom Lane
Subject Re: How to cancel a query if SIGINT does not work?
Date
Msg-id 26126.1124472048@sss.pgh.pa.us
Whole thread Raw
In response to Re: How to cancel a query if SIGINT does not work?  (Adam Witney <awitney@sgul.ac.uk>)
List pgsql-general
Adam Witney <awitney@sgul.ac.uk> writes:
> (gdb) bt
> #0  0x40193812 in recv () from /lib/libc.so.6
> #1  0x081044d8 in secure_read ()
> #2  0x081084c7 in pq_recvbuf ()
> #3  0x0810853d in pq_getbyte ()
> #4  0x080cb12b in CopyGetData ()
> #5  0x080cb36e in CopyGetChar ()
> #6  0x080cd9d7 in CopyReadLine ()
> #7  0x080cce90 in CopyFrom ()
> #8  0x080cbdea in DoCopy ()
> #9  0x08157759 in ProcessUtility ()
> #10 0x08156a1b in PortalRunUtility ()
> #11 0x08156ae2 in PortalRunMulti ()
> #12 0x0815667e in PortalRun ()
> #13 0x08153843 in exec_simple_query ()
> #14 0x08155ab9 in PostgresMain ()
> #15 0x0813523d in BackendFork ()
> #16 0x08134ad5 in BackendStartup ()
> #17 0x08133439 in ServerLoop ()
> #18 0x08132fa5 in PostmasterMain ()
> #19 0x081097af in main ()
> #20 0x400dc14f in __libc_start_main () from /lib/libc.so.6

OK, apparently it's waiting for data from the client during a COPY FROM.

Not sure if we should try to fix things so that a SIGINT will work
there --- seems like it'd be more likely to bollix the protocol state
than do anything very useful.  Something for the TODO list.

> Also, what's the best way to cancel the query now?

Kill the connected client.  The recv() should error out once the network
connection is dropped.

            regards, tom lane

pgsql-general by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: How to cancel a query if SIGINT does not work?
Next
From: Martijn van Oosterhout
Date:
Subject: Re: libpq and unwanted stderr output