Received: from localhost (unknown [200.46.208.211]) by mail.postgresql.org (Postfix) with ESMTP id EF7EB63295E for ; Mon, 1 Jun 2009 20:30:59 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.208.211]) (amavisd-maia, port 10024) with ESMTP id 73695-03 for ; Mon, 1 Jun 2009 20:30:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from leary.csoft.net (leary.csoft.net [205.205.214.5]) by mail.postgresql.org (Postfix) with ESMTP id 6B4446322B5 for ; Mon, 1 Jun 2009 20:30:58 -0300 (ADT) Received: by leary.csoft.net (Postfix, from userid 1112) id 373FCA132; Mon, 1 Jun 2009 19:30:56 -0400 (EDT) Date: Mon, 1 Jun 2009 19:30:55 -0400 (EDT) From: Kris Jurka X-X-Sender: books@leary.csoft.net To: Oliver Jowett cc: Simon Riggs , Daniel Migowski , PostgreSQL - JDBC Subject: Re: Deadlock detection In-Reply-To: <4977D3DC.1080806@opencloud.com> Message-ID: References: <1232531884.2327.342.camel@ebony.2ndQuadrant> <49771246.9020306@ikoffice.de> <1232583410.2327.704.camel@ebony.2ndQuadrant> <4977BB90.8090806@opencloud.com> <4977C8FD.7040204@opencloud.com> <4977D10A.9040706@opencloud.com> <4977D3DC.1080806@opencloud.com> User-Agent: Alpine 2.00 (BSO 1167 2008-08-23) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.007 tagged_above=0 required=5 tests=AWL=0.007 X-Spam-Level: X-Archive-Number: 200906/1 X-Sequence-Number: 19665 On Thu, 22 Jan 2009, Oliver Jowett wrote: > Kris Jurka wrote: >> >> On Thu, 22 Jan 2009, Oliver Jowett wrote: >>> >>> This passes the regression testsuite with antiDeadlock=true, but I don't >>> have a deadlock testcase on hand to try unfortunately. >>> >> >> This has a test case which deadlocks consistently: >> >> http://archives.postgresql.org/pgsql-jdbc/2008-10/msg00045.php > > Perfect, thanks > > My changes seem to pass BatchDeadLock with antiDeadlock=true (and still > hang with antiDeadlock=false): I'm not really sure what to do with this code. It does two different things and what is does best really wasn't the thrust of this thread. 1) It avoids deadlocks by buffering the writes in local memory. That's great, but wasn't really the point of the thread. Would we suggest people run with antiDeadlock=true in a production environment to avoid deadlocks? If so, why wouldn't it be the default. 2) It warns when a deadlock has potentially occurred with stack trace information to provide the call location. That's good, but it can't be 100% accurate. With a small timeout it may warn when there wouldn't be an actual deadlock and with a large timeout it may not warn when the call would have deadlocked without the intermediate buffer. Having the intermediate buffer means that you aren't testing the same thing, so a success with antiDeadlock=true has no implications as to whether your application will deadlock with it turned off. Previously it was discussed that you'd really want to cap the buffer size, so perhaps relating the maximum buffer size to Socket.getSendBufferSize might make the results of testing with antiDeadlock more representative of the behavior with it turned off. So it's a useful piece of code, but I'm not sure what context it should really be used in. Is anyone using this? For what purpose? Kris Jurka