On Nov 22, 2004, at 5:30 AM, Bob Showalter wrote:

Kevin Bass wrote:
I have a slight problem that I am attemping to solve. I am using
CGI/Perl (DBD Oracle) on Linux AS 2.1 to access to the database. When
users encounter problems on the web, they cancel (or press stop) in
their browsers. This will stop there browser interaction and also
cause the database connection to not disconnect which causes a
runaway process. Is there an article that I can read or a
procedure/module or process that someone has written within CGI or
DBI (or sometimes else) that will allow me to kill my database
connection when a users stops an execute within his/her browser?
Thanks!

When the user presses the "Stop" button on their browser, the only thing
that happens is the connection back to the server is closed. The only way
for your script to detect this is to try to send data back to the client. If
the connection is closed, you'll receive SIGPIPE (which by default will
terminate your process).


You can catch the SIGPIPE and do a graceful shutdown on the db connection.

If you're in the middle of a query, you won't be able to detect the
connection being closed until the DBI call returns.


Note that while a plain CGI script might get a SIGPIPE, it won't be the case under mod_perl. There are no pipes under mod_perl and I have no idea how one would go about knowing if the user severed the connection.



-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to