Re: SPI_ERROR_CONNECT within pl/pgsql, PG 8.4 - Mailing list pgsql-bugs

From Frank van Vugt
Subject Re: SPI_ERROR_CONNECT within pl/pgsql, PG 8.4
Date
Msg-id 200907141518.16021.ftm.van.vugt@foxi.nl
Whole thread Raw
In response to SPI_ERROR_CONNECT within pl/pgsql, PG 8.4  (Frank van Vugt <ftm.van.vugt@foxi.nl>)
Responses Re: SPI_ERROR_CONNECT within pl/pgsql, PG 8.4  (Marek Lewczuk <marek@lewczuk.com>)
List pgsql-bugs
Hi Marek,

> Could you please send me gdb
> commands - I could also provide the backtrace

Basically the flow is as follows:

- identify the backend that you expect to run in to this error by pid

- start gdb with the option "-p <pid>" to attach to this backend

- set a conditional breakpoint:
    break SPI_connect if _SPI_curid != _SPI_connected
gdb should confirm this with something like Breakpoint 1 at 0x54af60

- tell gdb to ignore SIGUSR1:
    handle SIGUSR1 nostop
gdb should confirm this with something like:
    Signal        Stop      Print   Pass to program Description
    SIGUSR1       No        Yes     Yes             User defined signal 1

- tell gdb to ignore SIGUSR2:
    handle SIGUSR2 nostop
gdb should confirm this with something like:
    Signal        Stop      Print   Pass to program Description
    SIGUSR2       No        Yes     Yes             User defined signal 2

- type 'c' to allow the backend to continue

- reproduce the problem in your application, the moment you do it will seem to
'freeze' (so you will _not_ see any error message you usually were seeing, at
least not yet), because gdb will have catched the situation and should now
show a prompt again

- type 'bt' to get a backtrace, just copy&paste&post ;)

You can quit gdb by a plain <ctrl>-c, just confirm when it asks you to detach.
The backend will continue to run, your app should now show the error.





--
Best,




Frank.

pgsql-bugs by date:

Previous
From: Frank van Vugt
Date:
Subject: Re: SPI_ERROR_CONNECT within pl/pgsql, PG 8.4
Next
From: "Michael Gould"
Date:
Subject: BUG #4920: need case-insensitive searches