X-Original-To: pgsql-jdbc-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 08FB59DCC24 for ; Fri, 24 Mar 2006 16:57:06 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 46380-06 for ; Fri, 24 Mar 2006 16:57:06 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id C6DE19DCC1F for ; Fri, 24 Mar 2006 16:57:03 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id k2OKpUsU009141; Fri, 24 Mar 2006 15:51:30 -0500 (EST) To: Kris Jurka cc: David Blasby , pgsql-jdbc@postgresql.org Subject: Re: OutOfMemory causing connection leaks In-reply-to: References: <44243ECF.9020301@openplans.org> Comments: In-reply-to Kris Jurka message dated "Fri, 24 Mar 2006 14:15:27 -0500" Date: Fri, 24 Mar 2006 15:51:29 -0500 Message-ID: <9140.1143233489@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.114 required=5 tests=[AWL=0.114] X-Spam-Score: 0.114 X-Spam-Level: X-Archive-Number: 200603/106 X-Sequence-Number: 14887 Kris Jurka writes: > On Fri, 24 Mar 2006, David Blasby wrote: >> [OutOfMemory errors leave protocol stream in unknown state] > Yeah, that's a problem alright. The easiest thing to do is to treat an > out of memory error like an IOException and destroy the whole connection > immediately. This isn't terribly friendly though and the vast majority > of the errors are going to come from ReceiveTupleV3, so we could put some > checks in that path that could get the protocol back into a known state. > Adding checks around every allocation isn't going to be worth the effort. We went through this same evolution with libpq awhile back, and pretty much did what you say above: make sure that OOM during tuple collection was handled in a friendly way. OOM at other places is likely to leave things a bit broken. So far there've not been many complaints ... regards, tom lane