Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id CD5036368A5 for ; Thu, 28 Jan 2010 14:41:42 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 72942-07-4 for ; Thu, 28 Jan 2010 18:41:32 +0000 (UTC) Received: from pgfoundry.org (pgfoundry.org [200.46.204.130]) by mail.postgresql.org (Postfix) with ESMTP id 4319965A1B9 for ; Thu, 28 Jan 2010 14:41:26 -0400 (AST) Received: from maia.hub.org (maia-4.hub.org [200.46.204.183]) by pgfoundry.org (Postfix) with ESMTP id A7B4E10715F5; Thu, 28 Jan 2010 18:41:25 +0000 (UTC) Received: from pgfoundry.org ([200.46.204.130]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 72942-06; Thu, 28 Jan 2010 18:41:25 +0000 (UTC) Received: by pgfoundry.org (Postfix, from userid 80) id 5E06C10715F3; Thu, 28 Jan 2010 18:41:25 +0000 (UTC) To: noreply@pgfoundry.org From: Subject: [ psqlodbc-Bugs-1010758 ] Potential memory leak with savepoints and cursors Content-type: text/plain; charset=UTF-8 Message-Id: <20100128184125.5E06C10715F3@pgfoundry.org> Date: Thu, 28 Jan 2010 18:41:25 +0000 (UTC) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.001 tagged_above=-10 required=5 tests=BAYES_50=0.001 X-Spam-Level: X-Archive-Number: 201001/20 X-Sequence-Number: 10183 Bugs item #1010758, was opened at 2010-01-28 18:41 You can respond by visiting: http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1010758&group_id=1000125 Category: None Group: None Status: Open Resolution: None Priority: 3 Submitted By: Florian Nigsch (fnigsch) Assigned to: Nobody (None) Summary: Potential memory leak with savepoints and cursors Initial Comment: Problem: When executing a large number (100,000s) of queries the server eventually exhausts available memory and crashes. Likely cause: Problem with the release of savepoints; as seen in the PostgreSQL logs below, a savepoint is always created immediately before the cursor is closed, and this savepoint is then released once the cursor is closed. Shouldn't the savepoint be released before the enclosing cursor is closed? The logs below show that the savepoint creation/release is not enclosed by the cursor creation/destruction. psqlODBC driver used: psqlodbc_08_04_0100.zip PostgreSQL server: 8.4.0 LOG: statement: BEGIN;declare "SQL_CUR05898D98" cursor with hold for select * from ...;fetch 100 in "SQL_CUR05898D98" LOG: statement: declare "SQL_CUR0589C5B0" cursor for select n.nspname, c.relname, a.attname, a.atttypid, t.typname, a.attnum, a.attlen, a.atttypmod, a.attnotnull, c.relhasrules, c.relkind, c. oid, d.adsrc, case t.typtype when 'd' then t.typbasetype else 0 end, t.typtypmod from (((pg_catalog.pg_class c inner join pg_catalog.pg_namespace n on n.oid = c.relnamespace and c.oid = 632801 8) inner join pg_catalog.pg_attribute a on (not a.attisdropped) and a.attnum > 0 and a.attrelid = c.oid) inner join pg_catalog.pg_type t on t.oid = a.atttypid) left outer join pg_attrdef d on a.atthasdef and d.adrelid = a.attrelid and d.adnum = a.attnum order by n.nspname, c.relname, attnum;fetch 100 in "SQL_CUR0589C5B0" LOG: statement: SAVEPOINT _per_query_svp_;close "SQL_CUR0589C5B0";RELEASE _per_query_svp_ LOG: statement: SAVEPOINT _per_query_svp_;close "SQL_CUR05898D98";RELEASE _per_query_svp_ LOG: statement: declare "SQL_CUR05898D98" cursor with hold for select * from ...;fetch 100 in "SQL_CUR05898D98" LOG: statement: SAVEPOINT _per_query_svp_;close "SQL_CUR05898D98";RELEASE _per_query_svp_ LOG: statement: declare "SQL_CUR05898D98" cursor with hold for select * from ...;fetch 100 in "SQL_CUR05898D98" LOG: statement: SAVEPOINT _per_query_svp_;close "SQL_CUR05898D98";RELEASE _per_query_svp_ ---------------------------------------------------------------------- You can respond by visiting: http://pgfoundry.org/tracker/?func=detail&atid=538&aid=1010758&group_id=1000125