Re: Unhappy with error handling in psql's handleCopyOut()

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Stephen Frost <sfrost(at)snowman(dot)net>
Cc: Noah Misch <noah(at)leadboat(dot)com>, Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Unhappy with error handling in psql's handleCopyOut()
Date: 2014-02-11 21:29:02
Message-ID: 30402.1392154142@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Stephen Frost <sfrost(at)snowman(dot)net> writes:
> I've not gotten back to it yet, but I ran into a related-seeming issue
> where psql would happily chew up 2G of memory trying to send "COPY
> failed" notices when it gets disconnected from a server that it's trying
> to send data to mid-COPY. conn->sock was -1, connection was
> 'CONNECTION_BAD', but the loop towards the end of handleCopyIn doesn't
> care and nothing in libpq is changing PQresultStatus():

[ scratches head... ] Offhand I'd have expected PQgetResult to start
returning error indications. It definitely will do that if it gets
error indications from the I/O layer. Perhaps it didn't see any
because asyncStatus had already been reset from PGASYNC_BUSY?

If so, maybe we need an explicit test on the connection being good before
we return valid PGRES_COPY_IN etc results.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2014-02-11 22:03:11 Re: Unhappy with error handling in psql's handleCopyOut()
Previous Message Peter Eisentraut 2014-02-11 21:04:30 Re: Patch: compiling the docs under Gentoo