Re: [GENERAL] how to cancel a request in progress ?

Started by Simon Drabblealmost 27 years ago7 messagesgeneral
Jump to latest
#1Simon Drabble
simond@foxlink.net

On Tue, 25 May 1999, Jonathan Davis wrote:

hello all

is this possible to cancel a request in progress ?

If you are using the interactive monitor, psql, try ctrl-c.

If you are using the libpq or other interface, then it becomes much more
application specific, i.e. you might have to kill off the app.

Simon.

--
"The world will end at Dec 31 1999 23:59:59. Please save your work and log
off before then or risk losing your data."

Simon Drabble Somewhere in cyberspace
simond@foxlink.net

#2Simon Drabble
simond@foxlink.net
In reply to: Simon Drabble (#1)

On Tue, 25 May 1999, Jonathan Davis wrote:

Simon Drabble wrote:

On Tue, 25 May 1999, Jonathan Davis wrote:

hello all

is this possible to cancel a request in progress ?

If you are using the interactive monitor, psql, try ctrl-c.

If you are using the libpq or other interface, then it becomes much more
application specific, i.e. you might have to kill off the app.

but how do you kill a request in progress?

I 'm using the libpq,.

Kill it off without killing the ap you mean? Unless your app is multi-threaded
or multi-process and uses IPC, you might not be able to.

You can use the asynch access functions within libpq, which will give control
back to your program. If you then decide at a later point that the database
command has not returned, you can kill it off if it is within a subthread or
subprocess (from a fork(), e.g.) but AFAIK there is no libpq or postgres
function to terminate a running command.

Actually it might be a better idea have your subprocess handle the db request
synchronously, and then the parent can time it out if it takes too long and
send a signal to the child to terminate it. This could be quite messy,
however, so if you are doing inserts or anything which affects a table's
contents, I would wrap it in a BEGIN..END transaction.

Simon.

--
"The world will end at Dec 31 1999 23:59:59. Please save your work and log
off before then or risk losing your data."

Simon Drabble Somewhere in cyberspace
simond@foxlink.net

#3Simon Drabble
simond@foxlink.net
In reply to: Simon Drabble (#2)

On Tue, 25 May 1999, Jonathan Davis wrote:

Jonathan Davis wrote:

Simon Drabble wrote:

On Tue, 25 May 1999, Jonathan Davis wrote:

hello all

is this possible to cancel a request in progress ?

If you are using the interactive monitor, psql, try ctrl-c.

If you are using the libpq or other interface, then it becomes much more
application specific, i.e. you might have to kill off the app.

but how do you kill a request in progress?

Simon.

I 'm using the libpq,.

it is possible by : PQrequestCancel but you must use the Asynchronous
Query Processing
(PQsendQuery/PQgetResult).

--
"The world will end at Dec 31 1999 23:59:59. Please save your work and log
off before then or risk losing your data."

Simon Drabble Somewhere in cyberspace
simond@foxlink.net

#4Michael A. Koerber
mak@ll.mit.edu
In reply to: Simon Drabble (#3)

It isn't pretty, but as 'su' or 'postgres' you can kill the the "postmaster pid".
However, you may have to clean up 'junk files' left in the data base. Don't do
this except as a last resort.

mike

--
-------------------------------------------------------
It said use Windows 95 or better, so I installed Linux!
--
Dr Michael A. Koerber
MIT/Lincoln Laboratory
781-981-3250
-------------------------------------------------------

#5Simon Drabble
simond@foxlink.net
In reply to: Michael A. Koerber (#4)

On Tue, 24 May 1999, Michael A. Koerber wrote:

It isn't pretty, but as 'su' or 'postgres' you can kill the the "postmaster pid".
However, you may have to clean up 'junk files' left in the data base. Don't do
this except as a last resort.

mike

--
-------------------------------------------------------
It said use Windows 95 or better, so I installed Linux!
--
Dr Michael A. Koerber
MIT/Lincoln Laboratory
781-981-3250
-------------------------------------------------------

Hmmm. Sledgehammer, this is nut. Nut, meet sledgehammer. :)

Jonathan found the optimal solution - PQrequestCancel() from within the app.

Simon.

--
"The world will end at Dec 31 1999 23:59:59. Please save your work and log
off before then or risk losing your data."

Simon Drabble Somewhere in cyberspace
simond@foxlink.net

#6Jonathan davis
haj@idianet.net
In reply to: Simon Drabble (#1)

Simon Drabble wrote:

On Tue, 25 May 1999, Jonathan Davis wrote:

hello all

is this possible to cancel a request in progress ?

If you are using the interactive monitor, psql, try ctrl-c.

If you are using the libpq or other interface, then it becomes much more
application specific, i.e. you might have to kill off the app.

but how do you kill a request in progress?

Simon.

I 'm using the libpq,.

#7Jonathan davis
haj@idianet.net
In reply to: Simon Drabble (#1)

Jonathan Davis wrote:

Simon Drabble wrote:

On Tue, 25 May 1999, Jonathan Davis wrote:

hello all

is this possible to cancel a request in progress ?

If you are using the interactive monitor, psql, try ctrl-c.

If you are using the libpq or other interface, then it becomes much more
application specific, i.e. you might have to kill off the app.

but how do you kill a request in progress?

Simon.

I 'm using the libpq,.

it is possible by : PQrequestCancel but you must use the Asynchronous
Query Processing
(PQsendQuery/PQgetResult).