Cancel statements when closing connection at transaction end.

That's important because the currently running statement on a worker
might continue to hold locks and consume resources, even after the
connection is closed.  Unfortunately postgres will only notice closed
connections when reading from / writing to the network. That might
only happen much later.
pull/1650/head
Andres Freund 2017-06-30 18:20:54 -07:00 committed by Metin Doslu
parent 25cabe634e
commit 992f2d907d
1 changed files with 1 additions and 2 deletions

View File

@ -720,8 +720,7 @@ AfterXactHostConnectionHandling(ConnectionHashEntry *entry, bool isCommit)
PQstatus(connection->pgConn) != CONNECTION_OK || PQstatus(connection->pgConn) != CONNECTION_OK ||
PQtransactionStatus(connection->pgConn) != PQTRANS_IDLE) PQtransactionStatus(connection->pgConn) != PQTRANS_IDLE)
{ {
PQfinish(connection->pgConn); ShutdownConnection(connection);
connection->pgConn = NULL;
/* unlink from list */ /* unlink from list */
dlist_delete(iter.cur); dlist_delete(iter.cur);