Dropped connection during COPY causes trouble - Mailing list pgsql-bugs

From Tom Lane
Subject Dropped connection during COPY causes trouble
Date
Msg-id 2969.932604301@sss.pgh.pa.us
Whole thread Raw
Responses Re: [BUGS] Dropped connection during COPY causes trouble
List pgsql-bugs
Don't kill a psql client that's in the middle of a COPY IN operation.

With current sources, the connected backend fails to quit, but instead
goes into an infinite loop writing
pq_recvbuf: unexpected EOF on client connection
to stderr over and over.

If you have postmaster stderr directed to a disk file, as I believe
is standard procedure, by and by the disk the postmaster logfile
is on fills up, and people start getting very unhappy...

I assume this is fairly easily fixed, but do not have a fix right this
instant.  It's probably my fault though --- I suppose it is an artifact
of the changes I made a couple months ago to prevent NOTICE messages
from coming out at inopportune times.  (If the bug were in pre-6.5
releases I'm sure we'd have heard about it before.)

Will produce a back-patch for 6.5 when I have it, but wanted to give
people a heads-up now.  Most embarrassing.

BTW, it occurs to me that the system ought to have provisions for
limiting the size of the logfile, rotating logfiles from time to
time, etc ... right now you cannot do those things easily except
by restarting the postmaster :-(.  Even without this bug, a determined
attacker could create a DOS attack by doing EXPLAIN VERBOSE enough
times to run the postmaster logfile up to full disk.  Bruce, I think
we need another TODO item:
  * prevent postmaster logfile from growing without bound

            regards, tom lane

pgsql-bugs by date:

Previous
From: Unprivileged user
Date:
Subject: General Bug Report: This message appears "malloc: cannot allocate memory"
Next
From: Bruce Momjian
Date:
Subject: Re: [BUGS] Dropped connection during COPY causes trouble