Re: How to cancel a query if SIGINT does not work?

From: Adam Witney <awitney(at)sgul(dot)ac(dot)uk>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: How to cancel a query if SIGINT does not work?
Date: 2005-08-19 17:10:28
Message-ID: BF2BD114.4B21D%awitney@sgul.ac.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 19/8/05 6:08 pm, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Adam Witney <awitney(at)sgul(dot)ac(dot)uk> writes:
>> On 19/8/05 5:27 pm, "Tom Lane" <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> In theory that should always work. What PG version is this? Can you
>>> attach to the stuck backend with gdb and get a stack trace?
>
>> Am not particularly familiar with gdb, but if you tell me the steps I will
>> do it and report back
>
> Think I've posted this before, but:
>
> Determine PID of backend you are interested in, eg with ps
>
> As postgres user, do
> $ gdb /path/to/postgres-executable PID-of-process
> gdb prints a bunch of junk
> gdb> bt
> ... copy and paste the output given here ...
> gdb> quit
> gdb: ok to detach? y
> $
>
> If you get a pile of purely numeric output from bt, it's useless
> (means you're running symbol-stripped executables). I'm hoping
> for at least some function names.

(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

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

Thanks again for your help

adam

--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Steve Crawford 2005-08-19 17:16:14 libpq and unwanted stderr output
Previous Message Tom Lane 2005-08-19 17:08:11 Re: How to cancel a query if SIGINT does not work?