Re: [HACKERS] Trouble in paradise: cancel via postmaster ain't so cool - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [HACKERS] Trouble in paradise: cancel via postmaster ain't so cool
Date
Msg-id 24587.899906177@sss.pgh.pa.us
Whole thread Raw
In response to Re: [HACKERS] Trouble in paradise: cancel via postmaster ain't so cool  ("Henry B. Hotz" <hotz@jpl.nasa.gov>)
List pgsql-hackers
"Henry B. Hotz" <hotz@jpl.nasa.gov> writes:
> Idea A:  precompute everything you need to do a cancel as part of sending
> the request in the first place so #1 above takes minimum effort (i.e. no
> malloc(), no gethostbyname(), no nothing).

Yeah, that's what I planned to try.  It'll mean making the PGconn
structure a little bigger to hold the info, but that seems OK.

> Idea B:  spawn (vfork()/exec()) a cancel process so all the funny stuff
> happens in a different address space.

Hadn't thought of that one... it'd have to be a real fork not a vfork,
consequently could be pretty expensive for a large application.
Still it might be a better answer than living with a nonreentrant
PQrequestCancel().

After sleeping on it, I feel like it should be possible to solve the
problem along the lines Henry mentions: have connectDB save everything
that it needs to get from C library routines, so that only kernel calls
are needed to open a new postmaster connection in PQrequestCancel.
Will work on that.

            regards, tom lane

pgsql-hackers by date:

Previous
From: Herouth Maoz
Date:
Subject: Re: [GENERAL] translate "bug"?
Next
From: jwieck@debis.com (Jan Wieck)
Date:
Subject: Re: [PG95-DEV] Rule system