Re: Failure to COMMIT -- Timeout? - Mailing list pgsql-novice

From Tom Lane
Subject Re: Failure to COMMIT -- Timeout?
Date
Msg-id 3236.967308126@sss.pgh.pa.us
Whole thread Raw
In response to Failure to COMMIT -- Timeout?  (Ben Lanson <lanson@bellatlantic.net>)
List pgsql-novice
Ben Lanson <lanson@bellatlantic.net> writes:
> BEGIN WORK
> UPDATE table
> (network outage prevents a COMMIT)

> If I am reading correctly, all other transactions will hang waiting to see
> if Transaction 1 commits.

Not "all others", just those that actually need to care whether that
xact commits --- in practice, xacts that want to update the same tuples
it did.

> Will postgres eventually time out the transaction and catch this problem?

In the current implementation, loss of connection to the client will be
detected eventually because we run TCP connections with SO_KEEPALIVE
set.  However KEEPALIVE is quite unaggressive; IIRC it takes about 2
hours before the kernel will lose all hope and declare the connection
lost.

> Testing in psql shows that the transaction is considered stopped (and
> rolled back) when the connection from psql is broken.  Is a broken network
> link (in this case established in PHP) an equivalent situation?

Once the kernel tells the backend that the connection is gone, the
backend will rollback its transaction and exit.  Your question therefore
reduces to a transport issue: when will the TCP stack report connection
loss/closure?

            regards, tom lane

pgsql-novice by date:

Previous
From: Charles Curley
Date:
Subject: Pg.pm oddity with apostrophes
Next
From: Webb Sprague
Date:
Subject: Re: Pg.pm oddity with apostrophes