Received: from maia.hub.org (maia-5.hub.org [200.46.204.29]) by mail.postgresql.org (Postfix) with ESMTP id 21A39B5DBB6 for ; Sat, 21 May 2011 12:45:51 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.29]) (amavisd-maia, port 10024) with ESMTP id 56067-03 for ; Sat, 21 May 2011 15:45:43 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from moutng.kundenserver.de (moutng.kundenserver.de [212.227.17.9]) by mail.postgresql.org (Postfix) with ESMTP id 8224FB5D801 for ; Sat, 21 May 2011 12:45:43 -0300 (ADT) Received: from [192.168.11.145] (riosat.com [89.140.90.230]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0LhH9w-1PstSm43uq-00mZIJ; Sat, 21 May 2011 17:45:41 +0200 Subject: Re: How to diagnose application "hangs" in pg_receive? From: Hannu Krosing To: Clemens Eisserer Cc: pgsql-jdbc@postgresql.org In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Sat, 21 May 2011 17:45:19 +0200 Message-ID: <1305992719.7708.47.camel@hvost> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:yLeI8KmnV3j8j7GSTVfBJAF7Nj4gWhdyFr+Y3UR1vh3 f05D/oadyCXl9fZAGx+xgbZenC6ou0T9pNjkxXZB+nl2UIlV+4 wRSp4IU5S40Gbt18reVnpbwgOwfOV7Js/mLZV1L+J1WQfcEAAF ZVa/VmtxmFFesqWmCGOBUi5A/upx6JYszcQSBEB1Zc9w4AGCSa uZvsbHhNjaK30As9+7xKnG/GkonRMAc66eHsIkOyQE= X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001 X-Spam-Level: X-Archive-Number: 201105/63 X-Sequence-Number: 21893 On Sat, 2011-05-21 at 16:08 +0200, Clemens Eisserer wrote: > Hi, > > A hibernate based application I wrote suffers from "hangs" - the > thread which should fetch the data is stuck at pg_receive (the > function reading back data from the socket). > My first idea were threading errors, however after careful code review > I couldn't find suspicious code. > The application doesn't do any explicit locking, an excerpt of the > locking table is at the end of the email. > > Any idea what could be going wrong here? I'm not an expert in JDBC so all the debugging advice is on server side :) > Except a broken connction, what could be the reason for never arriving > reply from the server? Maybe too small connection pool somewhere on the way, so the statement is waiting for connection, not for query answer ? to see if this is the case, set full logging in postgresql.conf and see if the query reaches the database at all. You could also start by setting statement_timeout to some sensible value so that you can rule out a hang statement / query maybe set statement_timeout to '5s'; would be a good value to start. > Thank you in advance, Clemens -- ------- Hannu Krosing PostgreSQL Infinite Scalability and Performance Consultant PG Admin Book: http://www.2ndQuadrant.com/books/