Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Zwv9F-00072z-IC for pgsql-committers@arkaria.postgresql.org; Thu, 12 Nov 2015 16:54:57 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Zwv9E-0000sC-Oy for pgsql-committers@arkaria.postgresql.org; Thu, 12 Nov 2015 16:54:56 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zwv92-0000ex-P9 for pgsql-committers@postgresql.org; Thu, 12 Nov 2015 16:54:44 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Zwv90-0005vn-9X for pgsql-committers@postgresql.org; Thu, 12 Nov 2015 16:54:43 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id tACGsejg030763; Thu, 12 Nov 2015 11:54:40 -0500 From: Tom Lane To: Robert Haas cc: pgsql-committers Subject: Re: pgsql: libpq: Notice errors a backend may have sent just before dying. In-reply-to: <25514.1447345518@sss.pgh.pa.us> References: <32700.1447338569@sss.pgh.pa.us> <25514.1447345518@sss.pgh.pa.us> Comments: In-reply-to Tom Lane message dated "Thu, 12 Nov 2015 11:25:18 -0500" Date: Thu, 12 Nov 2015 11:54:40 -0500 Message-ID: <30762.1447347280@sss.pgh.pa.us> X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-committers Precedence: bulk Sender: pgsql-committers-owner@postgresql.org I wrote: > After looking around, I suspect what actually happened in your test > was that we kept pumping pqReadData until it realized it was seeing EOF, > whereupon it did pqDropConnection(), and guess what that does: > /* Discard any unread/unsent data */ > conn->inStart = conn->inCursor = conn->inEnd = 0; > conn->outCount = 0; So after further review, this is a bug I introduced in 210eb9b74: the fact that some code paths flushed the buffers and some did not was less of an oversight than it appeared. That explains why the problem wasn't noticed years ago, because we'd certainly tested pqHandleSendFailure and friends before. I'm inclined to deal with this by adding a "dropInput" boolean flag to pqDropConnection(), rather than reverting the centralization of that logic altogether. I'll go clean this up ... regards, tom lane -- Sent via pgsql-committers mailing list (pgsql-committers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-committers