Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wdlfj-00020h-04 for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Apr 2014 19:20:31 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Wdlfi-0001aG-At for pgsql-bugs@arkaria.postgresql.org; Fri, 25 Apr 2014 19:20:30 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Wdlfh-0001a9-Ck for pgsql-bugs@postgresql.org; Fri, 25 Apr 2014 19:20:29 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WdlfU-0000z4-Mz for pgsql-bugs@postgresql.org; Fri, 25 Apr 2014 19:20:29 +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 s3PJKFtw013194; Fri, 25 Apr 2014 15:20:15 -0400 From: Tom Lane To: Stephen Frost cc: molind@gmail.com, pgsql-bugs@postgresql.org Subject: Re: BUG #10141: Server fails to send query result. In-reply-to: <20140425182142.GQ2556@tamriel.snowman.net> References: <20140425155227.2715.56833@wrigleys.postgresql.org> <20140425182142.GQ2556@tamriel.snowman.net> Comments: In-reply-to Stephen Frost message dated "Fri, 25 Apr 2014 14:21:42 -0400" Date: Fri, 25 Apr 2014 15:20:15 -0400 Message-ID: <13193.1398453615@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org Stephen Frost writes: > * molind@gmail.com (molind@gmail.com) wrote: >> I added PQtrace for each thread and wait for stuck thread. There is trace: >> From backend> D >> From backend (#4)> 139891 >> From backend> D >> From backend (#4)> 139891 >> From backend> D >> From backend (#4)> 139891 >> From backend> D >> From backend (#4)> 139891 >> From backend> D >> From backend (#4)> 139891 >> From backend> D >> From backend (#4)> 139891 FWIW, this looks suspiciously like libpq is unable to consume data from its input buffer (and keeps retrying to process the same data). Are you using PQsetnonblocking by any chance? If so, this probably indicates failure to follow the required call sequencing to process data. Another likely theory, given that you mentioned multiple client threads, is that the threads are stomping on each others' toes somehow. libpq does not defend itself against that: it's up to you to be sure that only one thread is touching each PGconn object. >> Seems problem somewhere inside PostgreSQL. It tries to send result but >> fails. > I don't see anything here which shows that to be the case. Indeed. I'd bet considerable money that this is a client-side issue. It's possible that it's a libpq bug, but what seems more likely is that you're using libpq improperly. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs