timeout for a transaction

Started by HYipalmost 25 years ago2 messagesgeneral
Jump to latest
#1HYip
hualinyip@earthlink.net

I have a connection opened, and begin a transaction. If tomcat or web
server dies for no reasons, I found that in the backend, there is a
postgresql server process waiting for the transaction to complete. It
blocks all my database calls because of this waiting process. I have to
manually kill that waiting process to unlock the database.

Is there any way of setting a timeout for the transaction? How come the
postgresql server doesn't detect the client dies, rollback and release
the resources?

I want the system be able to do it automatically. Any suggestions?

Thanks,
Percy

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: HYip (#1)
Re: timeout for a transaction

HYip <hualinyip@earthlink.net> writes:

I have a connection opened, and begin a transaction. If tomcat or web
server dies for no reasons, I found that in the backend, there is a
postgresql server process waiting for the transaction to complete. It
blocks all my database calls because of this waiting process.

The backend will abort its transaction and exit when it observes closure
of the client connection. If your webserver is holding open the TCP
connection even after it's stopped processing your script, then you'd
best fix the webserver.

regards, tom lane