From dnschnur@gmail.com Wed Nov 23 16:03:42 2011 Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 19C5A1E34FD7 for ; Wed, 23 Nov 2011 12:03:42 -0400 (AST) Received: from mail-qy0-f174.google.com ([209.85.216.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RTFIT-0003L2-5K for pgsql-admin@postgresql.org; Wed, 23 Nov 2011 16:03:41 +0000 Received: by qyd20 with SMTP id 20so515216qyd.19 for ; Wed, 23 Nov 2011 08:03:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=ifS+qKXexo+3UYYHAvpZ/HIQMVLRbOiWhAhLQSqFecA=; b=gwu7y+AzWNV/ODqcso8BuqqU7qlLafTuJS3jcsb5aV0LY7HlGQMu7f05qAdrX24H9j 9v3P0Kbu9JYS5+hohrgDVTFWPjf/lCfhvsN2Y0SBtRBMudpHgWSxMy3sgzPhIh7yGgdF v3WrNypNinh7ff6hqgv4bwgz451jpcm0JgtcU= MIME-Version: 1.0 Received: by 10.68.30.193 with SMTP id u1mr9134009pbh.93.1322064208175; Wed, 23 Nov 2011 08:03:28 -0800 (PST) Received: by 10.143.164.10 with HTTP; Wed, 23 Nov 2011 08:03:28 -0800 (PST) Date: Wed, 23 Nov 2011 11:03:28 -0500 Message-ID: Subject: Repeatable crash in pg_dump (with -d2 info) From: David Schnur To: pgsql-admin@postgresql.org Content-Type: multipart/alternative; boundary=bcaec51dd56f7fa16404b2690f8d X-Archive-Number: 201111/123 X-Sequence-Number: 38717 --bcaec51dd56f7fa16404b2690f8d Content-Type: text/plain; charset=ISO-8859-1 I'm seeing pg_dump [8.3.15 Windows] crash reproducibly against a particular database. Searching the web, I found [ http://grokbase.com/t/postgresql.org/pgsql-general/2001/02/pg-dump-crash/06ss55h5l35jh4bnnqfigxisy534] with a response from Tom Lane suggesting that it was probably due to a bug in pg_dump related to dumping functions. That post was made more than 10 years ago, but I figured it was worth a try, and set my pg_dump to run with PGOPTIONS="-d2". Sure enough, the crash is preceded by the following lines: SELECT proretset, prosrc, probin, proallargtypes, proargmodes, proargnames, provolatile, proisstrict, prosecdef, proconfig, procost, prorows, (SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) as lanname FROM pg_catalog.pg_proc WHERE oid = '16730'::pg_catalog.oid SELECT pg_catalog.format_type('1185'::pg_catalog.oid, NULL) SELECT pg_catalog.format_type('1022'::pg_catalog.oid, NULL) SELECT pg_catalog.format_type('1184'::pg_catalog.oid, NULL) SELECT pg_catalog.format_type('701'::pg_catalog.oid, NULL) SELECT pg_catalog.format_type('1185'::pg_catalog.oid, NULL) SELECT pg_catalog.format_type('1022'::pg_catalog.oid, NULL) SELECT pg_catalog.format_type('2249'::pg_catalog.oid, NULL) The OIDs 1185, 1022, 1184 and 701 are present in proallargtypes, so pg_dump appears to be looking up argument types for that function. I couldn't see 2249 anywhere, though, so I ran this: SELECT * FROM pg_catalog.pg_proc WHERE oid = '16730' And 2249 showed up in prorettype. The result from that last query is 'record', since the function RETURNS SETOF RECORD. That original post turned out to be some temporary trigger function that the user simply deleted to solve the problem. This function, however, is legitimate, and I can't simply delete it. Does anyone know what might be happening here, and how to work around it? Thanks! --bcaec51dd56f7fa16404b2690f8d Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
I'm seeing pg_dump [8.3.15 Windows] crash reproducibly against a p= articular database. =A0Searching the web, I found [http://grokbase.com/t/postgresql.org/pgsql-general/2001/02/p= g-dump-crash/06ss55h5l35jh4bnnqfigxisy534]=A0with a response from Tom L= ane suggesting that it was probably due to a bug in pg_dump related to dump= ing functions.

That post was made more than 10 years ago, but I figure= d it was worth a try, and set my pg_dump to run with PGOPTIONS=3D"-d2&= quot;. =A0Sure enough, the crash is preceded by the following lines:
<= div>
SELECT proretset, prosrc, probin, proallargtypes, proar= gmodes, proargnames, provolatile, proisstrict, prosecdef, proconfig, procos= t, prorows, (SELECT lanname FROM pg_catalog.pg_language WHERE oid =3D prola= ng) as lanname FROM pg_catalog.pg_proc WHERE oid =3D '16730'::pg_ca= talog.oid
SELECT pg_catalog.format_type('1185'::pg_catalog.oi= d, NULL)
SELECT pg_catalog.format_type('1022'::pg_catalog= .oid, NULL)
SELECT pg_catalog.format_type('1184'::pg_cata= log.oid, NULL)
SELECT pg_catalog.format_type('701'::pg_catalog.oid, NULL)
SELECT pg_catalog.format_type('1185'::pg_catalog.oid, NULL)<= /div>
SELECT pg_catalog.format_type('1022'::pg_catalog.oid, NUL= L)
SELECT pg_catalog.format_type('2249'::pg_catalog.oid, NULL)

The OIDs 1185, 1022, 1184 and 701 are present = in proallargtypes, so pg_dump appears to be looking up argument types for t= hat function. =A0I couldn't see 2249 anywhere, though, so I=A0ran this:=

SELECT * FROM pg_catalog.pg_proc WHERE oid =3D '167= 30'

And 2249 showed up in prorettype. =A0The r= esult from that last query is 'record', since the function RETURNS = SETOF RECORD.

That original post turned out to be some temporary trig= ger function that the user simply deleted to solve the problem. =A0This fun= ction, however, is legitimate, and I can't simply delete it. =A0Does an= yone know what might be happening here, and how to work around it? =A0Thank= s!
--bcaec51dd56f7fa16404b2690f8d-- From tgl@sss.pgh.pa.us Wed Nov 23 17:05:18 2011 Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 1DCE41E34FD7 for ; Wed, 23 Nov 2011 13:05:18 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RTGG5-0004VV-90 for pgsql-admin@postgresql.org; Wed, 23 Nov 2011 17:05:17 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id pANH54nb028133; Wed, 23 Nov 2011 12:05:04 -0500 (EST) To: David Schnur cc: pgsql-admin@postgresql.org Subject: Re: Repeatable crash in pg_dump (with -d2 info) In-reply-to: References: Comments: In-reply-to David Schnur message dated "Wed, 23 Nov 2011 11:03:28 -0500" Date: Wed, 23 Nov 2011 12:05:03 -0500 Message-ID: <28131.1322067903@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 201111/124 X-Sequence-Number: 38718 David Schnur writes: > I'm seeing pg_dump [8.3.15 Windows] crash reproducibly against a particular > database. Can you provide a stack trace from the crash? There's some info about that here: http://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Windows though I think it's oriented towards backend crashes more than client-side crashes. Alternatively, do you have the SQL definition for the function you think is causing the crash? There's not much that anybody else is going to be able to do about this unless you can provide a reproducible test case. regards, tom lane From dnschnur@gmail.com Wed Nov 23 17:42:18 2011 Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 919B21E34FD7 for ; Wed, 23 Nov 2011 13:42:18 -0400 (AST) Received: from mail-qw0-f53.google.com ([209.85.216.53]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RTGpt-0003UG-5Z for pgsql-admin@postgresql.org; Wed, 23 Nov 2011 17:42:17 +0000 Received: by qadb14 with SMTP id b14so1732266qad.19 for ; Wed, 23 Nov 2011 09:42:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=zcXASJ8nYbvxxzMsNmg4uPax+QDF1q2NvBqcUjRNPTU=; b=ZjsFZ2DFdVrHq1UKKJCtRTB1/m2I3ECeN7a7ncpQh1BDQmm5L5ax9VPkT8IvHlFzec ntkvISRxizj8nYdObVPAOvCRAcZAqzvc1qOwtNfiQQY2kPsE91Ekb1AJSndaZhHGuZkx 11wdYhv4X4JRYUBqhY486X7YkpWXIJDHu5/kw= MIME-Version: 1.0 Received: by 10.68.72.168 with SMTP id e8mr9728968pbv.127.1322070123784; Wed, 23 Nov 2011 09:42:03 -0800 (PST) Received: by 10.143.164.10 with HTTP; Wed, 23 Nov 2011 09:42:03 -0800 (PST) In-Reply-To: <28131.1322067903@sss.pgh.pa.us> References: <28131.1322067903@sss.pgh.pa.us> Date: Wed, 23 Nov 2011 12:42:03 -0500 Message-ID: Subject: Re: Repeatable crash in pg_dump (with -d2 info) From: David Schnur To: Tom Lane Cc: pgsql-admin@postgresql.org Content-Type: multipart/alternative; boundary=f46d0417027318a94b04b26a70fb X-Archive-Number: 201111/125 X-Sequence-Number: 38719 --f46d0417027318a94b04b26a70fb Content-Type: text/plain; charset=ISO-8859-1 Sure; the function is created programmatically as part of schema creation, by the same user who owns (almost) everything else in the database. The definition looks like this: CREATE OR REPLACE FUNCTION datastore_unpack( data_times TIMESTAMP WITH TIME ZONE[], data_values DOUBLE PRECISION[], OUT data_time TIMESTAMP WITH TIME ZONE, OUT data_value DOUBLE PRECISION ) RETURNS SETOF RECORD AS $$ SELECT $1[rowx] AS data_time, $2[rowx] AS data_value FROM generate_series(1, array_upper($1, 1)) AS rowx; $$ LANGUAGE SQL STABLE; It takes two parallel arrays and unpacks them into a set of records. --f46d0417027318a94b04b26a70fb Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Sure; the function is created programmatically as part of schema creation, = by the same user who owns (almost) everything else in the database. =A0The = definition looks like this:

=A0 =A0 =A0 =A0 CREATE = OR REPLACE FUNCTION datastore_unpack(
=A0 =A0 =A0 =A0 =A0 =A0 data_times TIMESTAMP WITH TIME ZONE[],
=A0 =A0 =A0 =A0 =A0 =A0 data_values DOUBLE PRECISION[],
=A0 = =A0 =A0 =A0 =A0 =A0 OUT data_time TIMESTAMP WITH TIME ZONE,
=A0 = =A0 =A0 =A0 =A0 =A0 OUT data_value DOUBLE PRECISION
=A0 =A0 =A0 =A0 ) RETURNS SETOF RECORD AS $$
=A0 =A0 =A0 =A0= =A0 =A0 SELECT $1[rowx] AS data_time, $2[rowx] AS data_value
=A0= =A0 =A0 =A0 =A0 =A0 FROM generate_series(1, array_upper($1, 1)) AS rowx;
=A0 =A0 =A0 =A0 $$ LANGUAGE SQL STABLE;

It takes two parallel arrays and unpacks them int= o a set of records.
--f46d0417027318a94b04b26a70fb-- From tgl@sss.pgh.pa.us Wed Nov 23 18:07:51 2011 Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 339091E34FD7 for ; Wed, 23 Nov 2011 14:07:51 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RTHEc-0005Vy-AK for pgsql-admin@postgresql.org; Wed, 23 Nov 2011 18:07:50 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id pANI7amO000347; Wed, 23 Nov 2011 13:07:37 -0500 (EST) To: David Schnur cc: pgsql-admin@postgresql.org Subject: Re: Repeatable crash in pg_dump (with -d2 info) In-reply-to: References: <28131.1322067903@sss.pgh.pa.us> Comments: In-reply-to David Schnur message dated "Wed, 23 Nov 2011 12:42:03 -0500" Date: Wed, 23 Nov 2011 13:07:36 -0500 Message-ID: <346.1322071656@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 201111/126 X-Sequence-Number: 38720 David Schnur writes: > Sure; the function is created programmatically as part of schema creation, > by the same user who owns (almost) everything else in the database. The > definition looks like this: > CREATE OR REPLACE FUNCTION datastore_unpack( > data_times TIMESTAMP WITH TIME ZONE[], > data_values DOUBLE PRECISION[], > OUT data_time TIMESTAMP WITH TIME ZONE, > OUT data_value DOUBLE PRECISION > ) RETURNS SETOF RECORD AS $$ > SELECT $1[rowx] AS data_time, $2[rowx] AS data_value > FROM generate_series(1, array_upper($1, 1)) AS rowx; > $$ LANGUAGE SQL STABLE; No crash observed here. So either we fixed it since 8.3.15 (doesn't seem likely, as I see nothing potentially related in the commit logs), or the trigger for the problem is not (just) this function. It seems entirely plausible that the crash is associated with the next-to-be-dumped object rather than this one, anyway. How about that stack trace? Alternatively, if you have an idea of the next object it might be working on (most likely, the next function in alphabetical order) you might see if loading just that function into an empty database is enough to create a crash. It's also entirely plausible that the crash requires multiple objects to trigger it (for instance it might have something to do with inter-object dependencies). So if you're not eager to burrow into stack traces, you might see if you can strip your standard schema down to something you could post that still triggers the crash starting from an empty database. regards, tom lane From dnschnur@gmail.com Mon Nov 28 22:20:59 2011 Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 256A7A333F2 for ; Mon, 28 Nov 2011 18:20:59 -0400 (AST) Received: from mail-pz0-f44.google.com ([209.85.210.44]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RV9ZH-000471-N9 for pgsql-admin@postgresql.org; Mon, 28 Nov 2011 22:20:58 +0000 Received: by pzk33 with SMTP id 33so12004370pzk.3 for ; Mon, 28 Nov 2011 14:20:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=qLg0pRUBmgcmcl4shZ5sfp+kaFwo57OF6oTF+rXINi0=; b=CDCxMPqr4PVzDC7XrGzVYgNAWD4F298N+RpMvvRlsbEfulNUgp0edWbzgAdZqGbKXO XyPv4v8gFb8RVZSfgKo/YvTLbIK20KZBlynQyWR1YzJOfd2iM3DCxRS88kGWQUvKc5JZ 4FC75/DK/E2h70LyXmURGegI4l8nakXv9e/RA= MIME-Version: 1.0 Received: by 10.68.40.40 with SMTP id u8mr37812787pbk.107.1322518842221; Mon, 28 Nov 2011 14:20:42 -0800 (PST) Received: by 10.143.168.8 with HTTP; Mon, 28 Nov 2011 14:20:42 -0800 (PST) In-Reply-To: <346.1322071656@sss.pgh.pa.us> References: <28131.1322067903@sss.pgh.pa.us> <346.1322071656@sss.pgh.pa.us> Date: Mon, 28 Nov 2011 17:20:42 -0500 Message-ID: Subject: Re: Repeatable crash in pg_dump (with -d2 info) From: David Schnur To: Tom Lane Cc: pgsql-admin@postgresql.org Content-Type: multipart/alternative; boundary=bcaec53961d2cca41304b2d2e98a X-Pg-Spam-Score: -2.7 (--) X-Archive-Number: 201111/133 X-Sequence-Number: 38727 --bcaec53961d2cca41304b2d2e98a Content-Type: text/plain; charset=ISO-8859-1 I probably can't get a stack trace, but I was able to reproduce it with just that function. Without the function, pg_dump works fine. I can DROP the function, pg_dump works, then add it back again and pg_dump crashes. Here are my steps: initdb -A md5 --no-locale -E UTF8 -U testuser -D "C:\Users\David\Desktop\testdb" -W pg_ctl -U testuser -D "C:\Users\David\Desktop\testdb" start CREATE DATABASE testdb OWNER testuser; CREATE OR REPLACE FUNCTION datastore_unpack( data_times TIMESTAMP WITH TIME ZONE[], data_values DOUBLE PRECISION[], OUT data_time TIMESTAMP WITH TIME ZONE, OUT data_value DOUBLE PRECISION ) RETURNS SETOF RECORD AS $$ SELECT $1[rowx] AS data_time, $2[rowx] AS data_value FROM generate_series(1, array_upper($1, 1)) AS rowx; $$ LANGUAGE SQL STABLE; pg_dump -v -F c -x -O -f "C:\Users\David\Desktop\dumptest" -U testuser testdb Here's the output from pg_dump: pg_dump: reading schemas pg_dump: reading user-defined functions pg_dump: reading user-defined types pg_dump: reading procedural languages pg_dump: reading user-defined aggregate functions pg_dump: reading user-defined operators pg_dump: reading user-defined operator classes pg_dump: reading user-defined text search parsers pg_dump: reading user-defined text search templates pg_dump: reading user-defined text search dictionaries pg_dump: reading user-defined text search configurations pg_dump: reading user-defined operator families pg_dump: reading user-defined conversions pg_dump: reading user-defined tables pg_dump: reading table inheritance information pg_dump: reading rewrite rules pg_dump: reading type casts pg_dump: finding inheritance relationships pg_dump: reading column info for interesting tables pg_dump: flagging inherited columns in subtables pg_dump: reading indexes pg_dump: reading constraints pg_dump: reading triggers pg_dump: reading dependency data pg_dump: saving encoding = UTF8 pg_dump: saving standard_conforming_strings = off pg_dump: saving database definition And here's the output from the postmaster: LOG: statement: SET DATESTYLE = ISO LOG: statement: SET extra_float_digits TO 2 LOG: statement: SET synchronize_seqscans TO off LOG: statement: BEGIN LOG: statement: SET TRANSACTION ISOLATION LEVEL SERIALIZABLE LOG: statement: SET search_path = pg_catalog LOG: statement: SELECT tableoid, oid, nspname, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = nspowner) as rolname, nspacl FROM pg_namespace LOG: statement: SELECT tableoid, oid, proname, prolang, pronargs, proargtypes, prorettype, proacl, pronamespace,(SELECT rolname FROM pg_catalog.pg_roles WHERE oid = proowner) as rolname FROM pg_proc WHERE NOT proisagg AND pronamespace != (select oid from pg_namespace where nspname = 'pg_catalog') LOG: statement: SELECT tableoid, oid, typname, typnamespace, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = typowner) as rolname, typinput::oid as typinput, typoutput::oid as typoutput, typelem, typrelid, CASE WHEN typrelid = 0 THEN ' '::"char" ELSE (SELECT relkind FROM pg_class WHERE oid = typrelid) END as typrelkind, typtype, typisdefined, typname[0] = '_' AND typelem != 0 AND (SELECT typarray FROM pg_type te WHERE oid = pg_type.typelem) = oid AS isarray FROM pg_type LOG: statement: SELECT tableoid, oid, lanname, lanpltrusted, lanplcallfoid, lanvalidator, lanacl, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = lanowner) as lanowner FROM pg_language WHERE lanispl ORDER BY oid LOG: statement: SELECT tableoid, oid, proname as aggname, pronamespace as aggnamespace, pronargs, proargtypes, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = proowner) as rolname, proacl as aggacl FROM pg_proc WHERE proisagg AND pronamespace != (select oid from pg_namespace where nspname = 'pg_catalog') LOG: statement: SELECT tableoid, oid, oprname, oprnamespace, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = oprowner) as rolname, oprcode::oid as oprcode FROM pg_operator LOG: statement: SELECT tableoid, oid, opcname, opcnamespace, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = opcowner) as rolname FROM pg_opclass LOG: statement: SELECT tableoid, oid, prsname, prsnamespace, prsstart::oid, prstoken::oid, prsend::oid, prsheadline::oid, prslextype::oid FROM pg_ts_parser LOG: statement: SELECT tableoid, oid, tmplname, tmplnamespace, tmplinit::oid, tmpllexize::oid FROM pg_ts_template LOG: statement: SELECT tableoid, oid, dictname, dictnamespace, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = dictowner) as rolname, dicttemplate, dictinitoption FROM pg_ts_dict LOG: statement: SELECT tableoid, oid, cfgname, cfgnamespace, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = cfgowner) as rolname, cfgparser FROM pg_ts_config LOG: statement: SELECT tableoid, oid, opfname, opfnamespace, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = opfowner) as rolname FROM pg_opfamily LOG: statement: SELECT tableoid, oid, conname, connamespace, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = conowner) as rolname FROM pg_conversion LOG: statement: SELECT c.tableoid, c.oid, relname, relacl, relkind, relnamespace, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = relowner) as rolname, relchecks, reltriggers, relhasindex, relhasrules, relhasoids, d.refobjid as owning_tab, d.refobjsubid as owning_col, (SELECT spcname FROM pg_tablespace t WHERE t.oid = c.reltablespace) AS reltablespace, array_to_string(c.reloptions, ', ') as reloptions from pg_class c left join pg_depend d on (c.relkind = 'S' and d.classid = c.tableoid and d.objid = c.oid and d.objsubid = 0 and d.refclassid = c.tableoid and d.deptype = 'a') where relkind in ('r', 'S', 'v', 'c') order by c.oid LOG: statement: SELECT inhrelid, inhparent from pg_inherits LOG: statement: SELECT tableoid, oid, rulename, ev_class as ruletable, ev_type, is_instead, ev_enabled FROM pg_rewrite ORDER BY oid LOG: statement: SELECT tableoid, oid, castsource, casttarget, castfunc, castcontext FROM pg_cast ORDER BY 3,4 LOG: statement: SELECT loid FROM pg_largeobject LIMIT 1 LOG: statement: SELECT classid, objid, refclassid, refobjid, deptype FROM pg_depend WHERE deptype != 'p' ORDER BY 1,2 LOG: statement: SELECT tableoid, oid, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = datdba) as dba, pg_encoding_to_char(encoding) as encoding, (SELECT spcname FROM pg_tablespace t WHERE t.oid = dattablespace) as tablespace, shobj_description(oid, 'pg_database') as description FROM pg_database WHERE datname = 'testdb' LOG: statement: SELECT description, classoid, objoid, objsubid FROM pg_catalog.pg_description ORDER BY classoid, objoid, objsubid LOG: statement: SET search_path = public, pg_catalog LOG: statement: SELECT proretset, prosrc, probin, proallargtypes, proargmodes, proargnames, provolatile, proisstrict, prosecdef, proconfig, procost, prorows, (SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) as lanname FROM pg_catalog.pg_proc WHERE oid = '16386'::pg_catalog.oid LOG: statement: SELECT pg_catalog.format_type('1185'::pg_catalog.oid, NULL) LOG: statement: SELECT pg_catalog.format_type('1022'::pg_catalog.oid, NULL) LOG: statement: SELECT pg_catalog.format_type('1184'::pg_catalog.oid, NULL) LOG: statement: SELECT pg_catalog.format_type('701'::pg_catalog.oid, NULL) LOG: statement: SELECT pg_catalog.format_type('1185'::pg_catalog.oid, NULL) LOG: statement: SELECT pg_catalog.format_type('1022'::pg_catalog.oid, NULL) LOG: statement: SELECT pg_catalog.format_type('2249'::pg_catalog.oid, NULL) LOG: could not receive data from client: No connection could be made because the target machine actively refused it. LOG: unexpected EOF on client connection --bcaec53961d2cca41304b2d2e98a Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I probably can't get a stack trace, but I was able to reproduce it with= just that function.=A0 Without the function, pg_dump works fine. =A0I can = DROP the function, pg_dump works, then add it back again and pg_dump crashe= s. =A0Here are my steps:

initdb -A md5 --n= o-locale -E UTF8 -U testuser -D "C:\Users\David\Desktop\testdb" -= W

pg_c= tl -U testuser -D "C:\Users\David\Desktop\testdb" start

CREATE DATABASE testdb OWNER testuser;

CREATE OR REPLACE FUNCTION datastore_unpack(
=A0 = =A0 data_times TIMESTAMP WITH TIME ZONE[],
=A0 =A0 data_values DO= UBLE PRECISION[],
=A0 =A0 OUT data_time TIMESTAMP WITH TIME ZONE,
=A0 =A0 OUT = data_value DOUBLE PRECISION
) RETURNS SETOF RECORD AS $$
=A0 =A0 SELECT $1[rowx] AS data_time, $2[rowx] AS data_value
= =A0 =A0 FROM generate_series(1, array_upper($1, 1)) AS rowx;
$$ LANGUAGE SQL STABLE;

pg_dump -v= -F c -x -O -f "C:\Users\David\Desktop\dumptest" -U testuser test= db

Here's the output from pg_dump:

pg_dump: reading schemas
pg_dump: readin= g user-defined functions
pg_dump: reading user-defined types
pg_dump: reading procedural languages
pg_dump: reading user= -defined aggregate functions
pg_dump: reading user-defined operators
pg_dump: reading use= r-defined operator classes
pg_dump: reading user-defined text sea= rch parsers
pg_dump: reading user-defined text search templates
pg_dump: reading user-defined text search dictionaries
pg_du= mp: reading user-defined text search configurations
pg_dump: read= ing user-defined operator families
pg_dump: reading user-defined = conversions
pg_dump: reading user-defined tables
pg_dump: reading table = inheritance information
pg_dump: reading rewrite rules
= pg_dump: reading type casts
pg_dump: finding inheritance relation= ships
pg_dump: reading column info for interesting tables
pg_dump:= flagging inherited columns in subtables
pg_dump: reading indexes=
pg_dump: reading constraints
pg_dump: reading triggers=
pg_dump: reading dependency data
pg_dump: saving encoding = =3D UTF8
pg_dump: saving standard_conforming_strings =3D off
pg_dump: saving database definition

An= d here's the output from the postmaster:

LOG: =A0statement: SET DATESTYLE =3D ISO
LOG: =A0statement: SET extra_float_digits TO 2
LOG: =A0statement= : SET synchronize_seqscans TO off
LOG: =A0statement: BEGIN
<= div>LOG: =A0statement: SET TRANSACTION ISOLATION LEVEL SERIALIZABLE
LOG: =A0statement: SET search_path =3D pg_catalog
LOG: =A0st= atement: SELECT tableoid, oid, nspname, (SELECT rolname FROM pg_catalog.pg_= roles WHERE oid =3D=A0nspowner) as rolname, nspacl FROM pg_namespace
<= div>LOG: =A0statement: SELECT tableoid, oid, proname, prolang, pronargs, pr= oargtypes, prorettype, proacl,=A0pronamespace,(SELECT rolname FROM pg_catal= og.pg_roles WHERE oid =3D proowner) as rolname FROM pg_proc=A0WHERE NOT pro= isagg AND pronamespace !=3D (select oid from pg_namespace where nspname =3D= 'pg_catalog')
LOG: =A0statement: SELECT tableoid, oid, typname, typnamespace, (SELEC= T rolname FROM pg_catalog.pg_roles WHERE oid =3D typowner) as rolname, typi= nput::oid as typinput, typoutput::oid as typoutput, typelem, typrelid, CASE= WHEN typrelid =3D 0 THEN ' '::"char" ELSE (SELECT relkin= d FROM pg_class WHERE oid =3D typrelid) END as typrelkind, typtype, typisde= fined, typname[0] =3D '_' AND typelem !=3D 0 AND (SELECT typarray F= ROM pg_type te WHERE oid =3D pg_type.typelem) =3D oid AS isarray FROM pg_ty= pe
LOG: =A0statement: SELECT tableoid, oid, lanname, lanpltrusted, lanplc= allfoid, lanvalidator, =A0lanacl,=A0(SELECT rolname FROM pg_catalog.pg_role= s WHERE oid =3D lanowner) as lanowner FROM pg_language WHERE lanispl ORDER = BY oid
LOG: =A0statement: SELECT tableoid, oid, proname as aggname, pronamesp= ace as aggnamespace, pronargs, proargtypes, (SELECT rolname FROM pg_catalog= .pg_roles WHERE oid =3D proowner) as rolname, proacl as aggacl FROM pg_proc= WHERE proisagg AND pronamespace !=3D (select oid from pg_namespace where n= spname =3D 'pg_catalog')
LOG: =A0statement: SELECT tableoid, oid, oprname, oprnamespace, (SELEC= T rolname FROM pg_catalog.pg_roles WHERE oid =3D oprowner) as rolname, oprc= ode::oid as oprcode FROM pg_operator
LOG: =A0statement: SELECT ta= bleoid, oid, opcname, opcnamespace, (SELECT rolname FROM pg_catalog.pg_role= s WHERE oid =3D opcowner) as rolname FROM pg_opclass
LOG: =A0statement: SELECT tableoid, oid, prsname, prsnamespace, prssta= rt::oid, prstoken::oid, prsend::oid, prsheadline::oid, prslextype::oid FROM= pg_ts_parser
LOG: =A0statement: SELECT tableoid, oid, tmplname, = tmplnamespace, tmplinit::oid, tmpllexize::oid FROM=A0pg_ts_template
LOG: =A0statement: SELECT tableoid, oid, dictname, dictnamespace, (SEL= ECT rolname FROM pg_catalog.pg_roles WHERE oid =3D dictowner) as rolname, d= icttemplate, dictinitoption FROM pg_ts_dict
LOG: =A0statement: SE= LECT tableoid, oid, cfgname, cfgnamespace, (SELECT rolname FROM pg_catalog.= pg_roles WHERE oid =3D cfgowner) as rolname, cfgparser FROM pg_ts_config
LOG: =A0statement: SELECT tableoid, oid, opfname, opfnamespace, (SELEC= T rolname FROM pg_catalog.pg_roles WHERE oid =3D opfowner) as rolname FROM = pg_opfamily
LOG: =A0statement: SELECT tableoid, oid, conname, con= namespace, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid =3D conowner)= as rolname FROM pg_conversion
LOG: =A0statement: SELECT c.tableoid, c.oid, relname, relacl, relkind,= relnamespace, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid =3D relow= ner) as rolname, relchecks, reltriggers, relhasindex, relhasrules, relhasoi= ds, d.refobjid as owning_tab, d.refobjsubid as owning_col, (SELECT spcname = FROM pg_tablespace t WHERE t.oid =3D c.reltablespace) AS reltablespace, arr= ay_to_string(c.reloptions, ', ') as=A0reloptions from pg_class c le= ft join pg_depend d on (c.relkind =3D 'S' and d.classid =3D c.table= oid and=A0d.objid =3D c.oid and d.objsubid =3D 0 and d.refclassid =3D c.tab= leoid and d.deptype =3D 'a') where relkind=A0in ('r', '= S', 'v', 'c') order by c.oid
LOG: =A0statement: SELECT inhrelid, inhparent from pg_inherits
LOG: =A0statement: SELECT tableoid, oid, rulename, ev_class as ruletable= , ev_type, is_instead, ev_enabled FROM pg_rewrite ORDER BY oid
LO= G: =A0statement: SELECT tableoid, oid, castsource, casttarget, castfunc, ca= stcontext FROM pg_cast ORDER BY 3,4
LOG: =A0statement: SELECT loid FROM pg_largeobject LIMIT 1
L= OG: =A0statement: SELECT classid, objid, refclassid, refobjid, deptype FROM= pg_depend WHERE deptype !=3D 'p' ORDER BY 1,2
LOG: =A0st= atement: SELECT tableoid, oid, (SELECT rolname FROM pg_catalog.pg_roles WHE= RE oid =3D datdba)=A0as dba, pg_encoding_to_char(encoding) as encoding, (SE= LECT spcname FROM pg_tablespace t WHERE t.oid=A0=3D dattablespace) as table= space, shobj_description(oid, 'pg_database') as description FROM pg= _database WHERE datname =3D 'testdb'
LOG: =A0statement: SELECT description, classoid, objoid, objsubid FROM= pg_catalog.pg_description ORDER=A0BY classoid, objoid, objsubid
= LOG: =A0statement: SET search_path =3D public, pg_catalog
LOG: = =A0statement: SELECT proretset, prosrc, probin, proallargtypes, proargmodes= , proargnames, provolatile, proisstrict, prosecdef, proconfig, procost, pro= rows, (SELECT lanname FROM pg_catalog.pg_language WHERE oid =3D prolang) as= lanname FROM pg_catalog.pg_proc WHERE oid =3D '16386'::pg_catalog.= oid
LOG: =A0statement: SELECT pg_catalog.format_type('1185'::pg_ca= talog.oid, NULL)
LOG: =A0statement: SELECT pg_catalog.format_type= ('1022'::pg_catalog.oid, NULL)
LOG: =A0statement: SELECT = pg_catalog.format_type('1184'::pg_catalog.oid, NULL)
LOG: =A0statement: SELECT pg_catalog.format_type('701'::pg_cat= alog.oid, NULL)
LOG: =A0statement: SELECT pg_catalog.format_type(= '1185'::pg_catalog.oid, NULL)
LOG: =A0statement: SELECT p= g_catalog.format_type('1022'::pg_catalog.oid, NULL)
LOG: =A0statement: SELECT pg_catalog.format_type('2249'::pg_ca= talog.oid, NULL)
LOG: =A0could not receive data from client: No c= onnection could be made because the target machine actively refused it.

LOG: =A0unexpected EOF on client connection
=
--bcaec53961d2cca41304b2d2e98a-- From tgl@sss.pgh.pa.us Tue Nov 29 01:00:49 2011 Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 3902F73DF74; Mon, 28 Nov 2011 21:00:49 -0400 (AST) Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RVC40-0001kr-If; Tue, 29 Nov 2011 01:00:49 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id pAT10ZUB029792; Mon, 28 Nov 2011 20:00:35 -0500 (EST) To: David Schnur cc: pgsql-admin@postgresql.org, pgsql-bugs@postgresql.org Subject: Re: Repeatable crash in pg_dump (with -d2 info) In-reply-to: References: <28131.1322067903@sss.pgh.pa.us> <346.1322071656@sss.pgh.pa.us> Comments: In-reply-to David Schnur message dated "Mon, 28 Nov 2011 17:20:42 -0500" Date: Mon, 28 Nov 2011 20:00:34 -0500 Message-ID: <29791.1322528434@sss.pgh.pa.us> From: Tom Lane X-Pg-Spam-Score: -3.1 (---) X-Archive-Number: 201111/134 X-Sequence-Number: 38728 David Schnur writes: > I probably can't get a stack trace, but I was able to reproduce it with > just that function. Without the function, pg_dump works fine. I can DROP > the function, pg_dump works, then add it back again and pg_dump crashes. Hmph. I still can't reproduce this here, which seems to mean one of three things: 1. We fixed this since 8.3.15 (still doesn't seem likely). 2. It's specific to Windows. 3. It's specific to the pg_dump build you are using. I wonder whether anyone else can get this to happen on the strength of David's description? > Here are my steps: > initdb -A md5 --no-locale -E UTF8 -U testuser -D > "C:\Users\David\Desktop\testdb" -W > pg_ctl -U testuser -D "C:\Users\David\Desktop\testdb" start > CREATE DATABASE testdb OWNER testuser; > CREATE OR REPLACE FUNCTION datastore_unpack( > data_times TIMESTAMP WITH TIME ZONE[], > data_values DOUBLE PRECISION[], > OUT data_time TIMESTAMP WITH TIME ZONE, > OUT data_value DOUBLE PRECISION > ) RETURNS SETOF RECORD AS $$ > SELECT $1[rowx] AS data_time, $2[rowx] AS data_value > FROM generate_series(1, array_upper($1, 1)) AS rowx; > $$ LANGUAGE SQL STABLE; > pg_dump -v -F c -x -O -f "C:\Users\David\Desktop\dumptest" -U testuser > testdb > Here's the output from pg_dump: > pg_dump: reading schemas > pg_dump: reading user-defined functions > pg_dump: reading user-defined types > pg_dump: reading procedural languages > pg_dump: reading user-defined aggregate functions > pg_dump: reading user-defined operators > pg_dump: reading user-defined operator classes > pg_dump: reading user-defined text search parsers > pg_dump: reading user-defined text search templates > pg_dump: reading user-defined text search dictionaries > pg_dump: reading user-defined text search configurations > pg_dump: reading user-defined operator families > pg_dump: reading user-defined conversions > pg_dump: reading user-defined tables > pg_dump: reading table inheritance information > pg_dump: reading rewrite rules > pg_dump: reading type casts > pg_dump: finding inheritance relationships > pg_dump: reading column info for interesting tables > pg_dump: flagging inherited columns in subtables > pg_dump: reading indexes > pg_dump: reading constraints > pg_dump: reading triggers > pg_dump: reading dependency data > pg_dump: saving encoding = UTF8 > pg_dump: saving standard_conforming_strings = off > pg_dump: saving database definition > And here's the output from the postmaster: > LOG: statement: SET DATESTYLE = ISO > LOG: statement: SET extra_float_digits TO 2 > LOG: statement: SET synchronize_seqscans TO off > LOG: statement: BEGIN > LOG: statement: SET TRANSACTION ISOLATION LEVEL SERIALIZABLE > LOG: statement: SET search_path = pg_catalog > LOG: statement: SELECT tableoid, oid, nspname, (SELECT rolname FROM > pg_catalog.pg_roles WHERE oid = nspowner) as rolname, nspacl FROM > pg_namespace > LOG: statement: SELECT tableoid, oid, proname, prolang, pronargs, > proargtypes, prorettype, proacl, pronamespace,(SELECT rolname FROM > pg_catalog.pg_roles WHERE oid = proowner) as rolname FROM pg_proc WHERE NOT > proisagg AND pronamespace != (select oid from pg_namespace where nspname = > 'pg_catalog') > LOG: statement: SELECT tableoid, oid, typname, typnamespace, (SELECT > rolname FROM pg_catalog.pg_roles WHERE oid = typowner) as rolname, > typinput::oid as typinput, typoutput::oid as typoutput, typelem, typrelid, > CASE WHEN typrelid = 0 THEN ' '::"char" ELSE (SELECT relkind FROM pg_class > WHERE oid = typrelid) END as typrelkind, typtype, typisdefined, typname[0] > = '_' AND typelem != 0 AND (SELECT typarray FROM pg_type te WHERE oid = > pg_type.typelem) = oid AS isarray FROM pg_type > LOG: statement: SELECT tableoid, oid, lanname, lanpltrusted, > lanplcallfoid, lanvalidator, lanacl, (SELECT rolname FROM > pg_catalog.pg_roles WHERE oid = lanowner) as lanowner FROM pg_language > WHERE lanispl ORDER BY oid > LOG: statement: SELECT tableoid, oid, proname as aggname, pronamespace as > aggnamespace, pronargs, proargtypes, (SELECT rolname FROM > pg_catalog.pg_roles WHERE oid = proowner) as rolname, proacl as aggacl FROM > pg_proc WHERE proisagg AND pronamespace != (select oid from pg_namespace > where nspname = 'pg_catalog') > LOG: statement: SELECT tableoid, oid, oprname, oprnamespace, (SELECT > rolname FROM pg_catalog.pg_roles WHERE oid = oprowner) as rolname, > oprcode::oid as oprcode FROM pg_operator > LOG: statement: SELECT tableoid, oid, opcname, opcnamespace, (SELECT > rolname FROM pg_catalog.pg_roles WHERE oid = opcowner) as rolname FROM > pg_opclass > LOG: statement: SELECT tableoid, oid, prsname, prsnamespace, > prsstart::oid, prstoken::oid, prsend::oid, prsheadline::oid, > prslextype::oid FROM pg_ts_parser > LOG: statement: SELECT tableoid, oid, tmplname, tmplnamespace, > tmplinit::oid, tmpllexize::oid FROM pg_ts_template > LOG: statement: SELECT tableoid, oid, dictname, dictnamespace, (SELECT > rolname FROM pg_catalog.pg_roles WHERE oid = dictowner) as rolname, > dicttemplate, dictinitoption FROM pg_ts_dict > LOG: statement: SELECT tableoid, oid, cfgname, cfgnamespace, (SELECT > rolname FROM pg_catalog.pg_roles WHERE oid = cfgowner) as rolname, > cfgparser FROM pg_ts_config > LOG: statement: SELECT tableoid, oid, opfname, opfnamespace, (SELECT > rolname FROM pg_catalog.pg_roles WHERE oid = opfowner) as rolname FROM > pg_opfamily > LOG: statement: SELECT tableoid, oid, conname, connamespace, (SELECT > rolname FROM pg_catalog.pg_roles WHERE oid = conowner) as rolname FROM > pg_conversion > LOG: statement: SELECT c.tableoid, c.oid, relname, relacl, relkind, > relnamespace, (SELECT rolname FROM pg_catalog.pg_roles WHERE oid = > relowner) as rolname, relchecks, reltriggers, relhasindex, relhasrules, > relhasoids, d.refobjid as owning_tab, d.refobjsubid as owning_col, (SELECT > spcname FROM pg_tablespace t WHERE t.oid = c.reltablespace) AS > reltablespace, array_to_string(c.reloptions, ', ') as reloptions from > pg_class c left join pg_depend d on (c.relkind = 'S' and d.classid = > c.tableoid and d.objid = c.oid and d.objsubid = 0 and d.refclassid = > c.tableoid and d.deptype = 'a') where relkind in ('r', 'S', 'v', 'c') order > by c.oid > LOG: statement: SELECT inhrelid, inhparent from pg_inherits > LOG: statement: SELECT tableoid, oid, rulename, ev_class as ruletable, > ev_type, is_instead, ev_enabled FROM pg_rewrite ORDER BY oid > LOG: statement: SELECT tableoid, oid, castsource, casttarget, castfunc, > castcontext FROM pg_cast ORDER BY 3,4 > LOG: statement: SELECT loid FROM pg_largeobject LIMIT 1 > LOG: statement: SELECT classid, objid, refclassid, refobjid, deptype FROM > pg_depend WHERE deptype != 'p' ORDER BY 1,2 > LOG: statement: SELECT tableoid, oid, (SELECT rolname FROM > pg_catalog.pg_roles WHERE oid = datdba) as dba, > pg_encoding_to_char(encoding) as encoding, (SELECT spcname FROM > pg_tablespace t WHERE t.oid = dattablespace) as tablespace, > shobj_description(oid, 'pg_database') as description FROM pg_database WHERE > datname = 'testdb' > LOG: statement: SELECT description, classoid, objoid, objsubid FROM > pg_catalog.pg_description ORDER BY classoid, objoid, objsubid > LOG: statement: SET search_path = public, pg_catalog > LOG: statement: SELECT proretset, prosrc, probin, proallargtypes, > proargmodes, proargnames, provolatile, proisstrict, prosecdef, proconfig, > procost, prorows, (SELECT lanname FROM pg_catalog.pg_language WHERE oid = > prolang) as lanname FROM pg_catalog.pg_proc WHERE oid = > '16386'::pg_catalog.oid > LOG: statement: SELECT pg_catalog.format_type('1185'::pg_catalog.oid, NULL) > LOG: statement: SELECT pg_catalog.format_type('1022'::pg_catalog.oid, NULL) > LOG: statement: SELECT pg_catalog.format_type('1184'::pg_catalog.oid, NULL) > LOG: statement: SELECT pg_catalog.format_type('701'::pg_catalog.oid, NULL) > LOG: statement: SELECT pg_catalog.format_type('1185'::pg_catalog.oid, NULL) > LOG: statement: SELECT pg_catalog.format_type('1022'::pg_catalog.oid, NULL) > LOG: statement: SELECT pg_catalog.format_type('2249'::pg_catalog.oid, NULL) > LOG: could not receive data from client: No connection could be made > because the target machine actively refused it. > LOG: unexpected EOF on client connection regards, tom lane From ringerc@ringerc.id.au Tue Nov 29 02:49:03 2011 Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id E704C19427CD for ; Mon, 28 Nov 2011 22:49:03 -0400 (AST) Received: from mail-vw0-f46.google.com ([209.85.212.46]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RVDkl-0000kP-K0 for pgsql-admin@postgresql.org; Tue, 29 Nov 2011 02:49:04 +0000 Received: by vbbfc26 with SMTP id fc26so4376168vbb.19 for ; Mon, 28 Nov 2011 18:48:50 -0800 (PST) Received: by 10.52.35.242 with SMTP id l18mr24501493vdj.39.1322534930630; Mon, 28 Nov 2011 18:48:50 -0800 (PST) Received: from ayaki.localdomain (124-169-45-65.dyn.iinet.net.au. [124.169.45.65]) by mx.google.com with ESMTPS id f11sm48532725vdj.15.2011.11.28.18.48.45 (version=SSLv3 cipher=OTHER); Mon, 28 Nov 2011 18:48:47 -0800 (PST) Message-ID: <4ED4480A.6090306@ringerc.id.au> Date: Tue, 29 Nov 2011 10:48:42 +0800 From: Craig Ringer User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:7.0.1) Gecko/20110930 Thunderbird/7.0.1 MIME-Version: 1.0 To: David Schnur CC: Tom Lane , pgsql-admin@postgresql.org Subject: Re: Repeatable crash in pg_dump (with -d2 info) References: <28131.1322067903@sss.pgh.pa.us> <346.1322071656@sss.pgh.pa.us> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201111/137 X-Sequence-Number: 38731 On 11/29/2011 06:20 AM, David Schnur wrote: > I probably can't get a stack trace Getting a usable stack trace on Windows isn't actually too hard. See: http://wiki.postgresql.org/wiki/Getting_a_stack_trace_of_a_running_PostgreSQL_backend_on_Windows That's focused on debugging the `postgres.exe' backend, but all the setup applies just as well to pg_dump. You then start pg_dump via windbg.exe or Visual Studio Express and, when it crashes, follow the instructions given in the wiki to produce the backtrace. -- Craig Ringer From dnschnur@gmail.com Tue Nov 29 15:28:53 2011 Received: from magus.postgresql.org (magus.postgresql.org [87.238.57.229]) by mail.postgresql.org (Postfix) with ESMTP id 49EEC19D7F5D for ; Tue, 29 Nov 2011 11:28:53 -0400 (AST) Received: from mail-gy0-f174.google.com ([209.85.160.174]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RVPbz-0007OI-7I for pgsql-admin@postgresql.org; Tue, 29 Nov 2011 15:28:52 +0000 Received: by ghrr1 with SMTP id r1so6490295ghr.19 for ; Tue, 29 Nov 2011 07:28:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=1l4JVzIFM8jF6QD9J9fpOmB1y3pgDZrOB+Hu0JYSHcU=; b=ms/6+DTRLZphjpCSIMTTBgUx3KiTwjUgYGFvSd+rYCLQ3dYN8YcMKdM49NIQtR+UFM O00SrTKYGQQPquNTamc/1gtUOCa4IeI36UZ1tXqNTvRht9lRQy8Iz5NGVRKzy47QlPqg jn9qYnFXXdZEoI/AFcnfL+gWRiLoAh676XJjg= MIME-Version: 1.0 Received: by 10.68.28.71 with SMTP id z7mr20965568pbg.124.1322580513643; Tue, 29 Nov 2011 07:28:33 -0800 (PST) Received: by 10.143.168.8 with HTTP; Tue, 29 Nov 2011 07:28:33 -0800 (PST) In-Reply-To: <4ED4480A.6090306@ringerc.id.au> References: <28131.1322067903@sss.pgh.pa.us> <346.1322071656@sss.pgh.pa.us> <4ED4480A.6090306@ringerc.id.au> Date: Tue, 29 Nov 2011 10:28:33 -0500 Message-ID: Subject: Re: Repeatable crash in pg_dump (with -d2 info) From: David Schnur To: Craig Ringer Cc: pgsql-admin@postgresql.org Content-Type: multipart/alternative; boundary=bcaec520e8f7b3dc2404b2e14590 X-Pg-Spam-Score: -2.7 (--) X-Archive-Number: 201111/139 X-Sequence-Number: 38733 --bcaec520e8f7b3dc2404b2e14590 Content-Type: text/plain; charset=ISO-8859-1 On Mon, Nov 28, 2011 at 9:48 PM, Craig Ringer wrote: > > Getting a usable stack trace on Windows isn't actually too hard. The problem isn't getting the trace - I know how to do that - it's that I don't have the pdbs for this build, and so the trace wouldn't be very useful. I may be able to get or recreate them, but can't right now. I am going to try this on Linux a little later today, though, to see if I can narrow it down in that regard. --bcaec520e8f7b3dc2404b2e14590 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
On Mon, Nov 28, 2011 at 9:48 PM, Craig Ringer=A0<= ringerc@ringerc.id.au>=A0wrote:
Getting a usable stack trace on Windows isn't actually too hard.

The problem isn't getting the trace - I know= how to do that - it's that I don't have the pdbs for this build, a= nd so the trace wouldn't be very useful. =A0I may be able to get or rec= reate them, but can't right now. =A0I am going to try this on Linux a l= ittle later today, though, to see if I can narrow it down in that regard. --bcaec520e8f7b3dc2404b2e14590-- From dnschnur@gmail.com Tue Jan 17 21:47:08 2012 Received: from makus.postgresql.org (makus.postgresql.org [98.129.198.125]) by mail.postgresql.org (Postfix) with ESMTP id 01B5F1DA4C1F; Tue, 17 Jan 2012 17:47:08 -0400 (AST) Received: from mail-pw0-f46.google.com ([209.85.160.46]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1RnGrv-0003r2-PJ; Tue, 17 Jan 2012 21:47:08 +0000 Received: by pbaa10 with SMTP id a10so1395599pba.19 for ; Tue, 17 Jan 2012 13:46:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=SijkqqkHA98jSt4W5LTr0TSnT6fTrqX9TyYtfh8vyMo=; b=N9w9ThuMDTdMunqDk8W3L1LrarS6fMalavA40gm3ZlbBBOCbJHhf9MMe3wEUNWatYe fGGqOS5cMW7tSfigjoO6Na2mY12nkxLNm5wjlpgx97pFt3QSuadoDZ5FwrFhpnGSygz2 8TXuKhMbv9qaUolGZDOIr0+1lArVfD2PycVyw= MIME-Version: 1.0 Received: by 10.68.191.3 with SMTP id gu3mr37443044pbc.112.1326836810799; Tue, 17 Jan 2012 13:46:50 -0800 (PST) Received: by 10.142.47.11 with HTTP; Tue, 17 Jan 2012 13:46:50 -0800 (PST) In-Reply-To: <29791.1322528434@sss.pgh.pa.us> References: <28131.1322067903@sss.pgh.pa.us> <346.1322071656@sss.pgh.pa.us> <29791.1322528434@sss.pgh.pa.us> Date: Tue, 17 Jan 2012 16:46:50 -0500 Message-ID: Subject: Re: Repeatable crash in pg_dump (with -d2 info) From: David Schnur To: Tom Lane Cc: pgsql-admin@postgresql.org, pgsql-bugs@postgresql.org Content-Type: multipart/alternative; boundary=e89a8ff1c374c8586404b6c044ea X-Pg-Spam-Score: -1.5 (-) X-Archive-Number: 201201/77 X-Sequence-Number: 38989 --e89a8ff1c374c8586404b6c044ea Content-Type: text/plain; charset=ISO-8859-1 I finally had time to test this further on a variety of systems, and was unable to reproduce on any non-Windows platform. The dump even works fine on Windows XP; just not Windows 7. This prompted me to do a little more research, and this time I found this thread from Sept. 2011: http://postgresql.1045698.n5.nabble.com/BUG-6233-pg-dump-hangs-with-Access-Violation-C0000005-td4851598.html From bruce@momjian.us Mon Aug 27 13:58:56 2012 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T5zqC-0001ap-OV; Mon, 27 Aug 2012 13:58:56 +0000 Received: from momjian.us ([72.94.173.45]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T5zqA-0003QH-D5; Mon, 27 Aug 2012 13:58:56 +0000 Received: from bruce by momjian.us with local (Exim 4.72) (envelope-from ) id 1T5zq8-0004tZ-PG; Mon, 27 Aug 2012 09:58:52 -0400 Date: Mon, 27 Aug 2012 09:58:52 -0400 From: Bruce Momjian To: David Schnur Cc: Tom Lane , pgsql-admin@postgresql.org, pgsql-bugs@postgresql.org Subject: Re: [ADMIN] Repeatable crash in pg_dump (with -d2 info) Message-ID: <20120827135852.GG11088@momjian.us> References: <28131.1322067903@sss.pgh.pa.us> <346.1322071656@sss.pgh.pa.us> <29791.1322528434@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Pg-Spam-Score: -1.0 (-) X-Archive-Number: 201208/199 X-Sequence-Number: 33923 On Tue, Jan 17, 2012 at 04:46:50PM -0500, David Schnur wrote: > I finally had time to test this further on a variety of systems, and was unable > to reproduce on any non-Windows platform. The dump even works fine on Windows > XP; just not Windows 7. > > This prompted me to do a little more research, and this time I found this > thread from Sept. 2011: > > http://postgresql.1045698.n5.nabble.com/ > BUG-6233-pg-dump-hangs-with-Access-Violation-C0000005-td4851598.html > > From Tom Lane in the above thread: > > > Hmm. I can see how that would happen if you're using one of the Windows > environments wherein malloc's done inside libpq have to be free'd inside > libpq. (The PQExpBuffer support code is in libpq...) > > > > However, the flaw in that explanation is that it would basically mean > pg_dump doesn't work at all on Windows, at least not if you have any > user-defined functions, and probably some other cases too because there > seem to be multiple instances of the dubious coding. It's a bit hard to > believe that nobody's noticed that before. > > > This appears to describe exactly the issue I'm encountering, and my build is in > fact linked against the static runtime. I guess the reason this hasn't come up > sooner is because most Windows users either use the 'official' binaries rather > than compiling from source, or link against the dynamic runtime. > > Is this something I could expect to be fixed in the near future, or is it > enough of an edge case that I should come up with some solution or work-around > on my own? Thanks, Late reply, but I don't see any way we could fix this easily. -- Bruce Momjian http://momjian.us EnterpriseDB http://enterprisedb.com + It's impossible for everything to be true. + From robertmhaas@gmail.com Thu Sep 6 18:45:07 2012 Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T9h4d-0001eL-F2; Thu, 06 Sep 2012 18:45:07 +0000 Received: from mail-iy0-f174.google.com ([209.85.210.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T9h4b-0001rK-S4; Thu, 06 Sep 2012 18:45:06 +0000 Received: by iahk25 with SMTP id k25so2382949iah.19 for ; Thu, 06 Sep 2012 11:45:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=q1Yi8cY5YB7H11rc4TTkCGIqLlxuoctrGOYfjaxh7UI=; b=EewpuU61CT8wUT/HDd3A7Qf3vJYUZV10oAUIa7zAOc+SIqNM5uceZSxTCrYT89Wm3B 2B6AIpoRuqCxwYmrnc90shbupp82xKCevEP2Pn/FL9ToyHX1/15knjf8xjtZJqNWn/5f +tOqZx3ZmA0SFtyI5RhDqHCdr7kGfflXTc3d4BcZ8fgC695h5GTG2S/60BiPOgP0LN6B 5YDCyhUE3fU8ip6DlXcPIRjDhoIHz9iU1/1ESdTgWaQjzPBY3d7VJ+yADmWwlI4zPRan IezkGnNS+VT3srqDhkp9e4B+r/6OR73RdHs21yTz7YJr5zZOBaC6TpjwSJrwue3HESmq myLA== MIME-Version: 1.0 Received: by 10.50.191.165 with SMTP id gz5mr4540549igc.50.1346957105332; Thu, 06 Sep 2012 11:45:05 -0700 (PDT) Received: by 10.64.7.242 with HTTP; Thu, 6 Sep 2012 11:45:05 -0700 (PDT) In-Reply-To: <20120827135852.GG11088@momjian.us> References: <28131.1322067903@sss.pgh.pa.us> <346.1322071656@sss.pgh.pa.us> <29791.1322528434@sss.pgh.pa.us> <20120827135852.GG11088@momjian.us> Date: Thu, 6 Sep 2012 14:45:05 -0400 Message-ID: Subject: Re: [ADMIN] Repeatable crash in pg_dump (with -d2 info) From: Robert Haas To: Bruce Momjian Cc: David Schnur , Tom Lane , pgsql-admin@postgresql.org, pgsql-bugs@postgresql.org Content-Type: text/plain; charset=ISO-8859-1 X-Pg-Spam-Score: -1.5 (-) X-Archive-Number: 201209/41 X-Sequence-Number: 34036 On Mon, Aug 27, 2012 at 9:58 AM, Bruce Momjian wrote: > On Tue, Jan 17, 2012 at 04:46:50PM -0500, David Schnur wrote: >> I finally had time to test this further on a variety of systems, and was unable >> to reproduce on any non-Windows platform. The dump even works fine on Windows >> XP; just not Windows 7. >> >> This prompted me to do a little more research, and this time I found this >> thread from Sept. 2011: >> >> http://postgresql.1045698.n5.nabble.com/ >> BUG-6233-pg-dump-hangs-with-Access-Violation-C0000005-td4851598.html >> >> From Tom Lane in the above thread: >> >> >> Hmm. I can see how that would happen if you're using one of the Windows >> environments wherein malloc's done inside libpq have to be free'd inside >> libpq. (The PQExpBuffer support code is in libpq...) >> >> >> >> However, the flaw in that explanation is that it would basically mean >> pg_dump doesn't work at all on Windows, at least not if you have any >> user-defined functions, and probably some other cases too because there >> seem to be multiple instances of the dubious coding. It's a bit hard to >> believe that nobody's noticed that before. >> >> >> This appears to describe exactly the issue I'm encountering, and my build is in >> fact linked against the static runtime. I guess the reason this hasn't come up >> sooner is because most Windows users either use the 'official' binaries rather >> than compiling from source, or link against the dynamic runtime. >> >> Is this something I could expect to be fixed in the near future, or is it >> enough of an edge case that I should come up with some solution or work-around >> on my own? Thanks, > > Late reply, but I don't see any way we could fix this easily. To me it seems like mostly a case of chasing down all the places where this happens. It's not impossible to do; it's just a bunch of work that nobody's gotten excited about doing yet. We've fixed similar issues in many other cases, IIUC. -- Robert Haas EnterpriseDB: http://www.enterprisedb.com The Enterprise PostgreSQL Company From tgl@sss.pgh.pa.us Thu Sep 6 20:02:45 2012 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T9iHl-0005Ru-L6; Thu, 06 Sep 2012 20:02:45 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T9iHi-00024B-5I; Thu, 06 Sep 2012 20:02:45 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id q86K2dcd025629; Thu, 6 Sep 2012 16:02:39 -0400 (EDT) From: Tom Lane To: Robert Haas cc: Bruce Momjian , David Schnur , pgsql-admin@postgresql.org, pgsql-bugs@postgresql.org Subject: Re: [ADMIN] Repeatable crash in pg_dump (with -d2 info) In-reply-to: References: <28131.1322067903@sss.pgh.pa.us> <346.1322071656@sss.pgh.pa.us> <29791.1322528434@sss.pgh.pa.us> <20120827135852.GG11088@momjian.us> Comments: In-reply-to Robert Haas message dated "Thu, 06 Sep 2012 14:45:05 -0400" Date: Thu, 06 Sep 2012 16:02:39 -0400 Message-ID: <25628.1346961759@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201209/47 X-Sequence-Number: 34042 Robert Haas writes: > On Mon, Aug 27, 2012 at 9:58 AM, Bruce Momjian wrote: >> From Tom Lane in the above thread: >>> Hmm. I can see how that would happen if you're using one of the Windows >>> environments wherein malloc's done inside libpq have to be free'd inside >>> libpq. (The PQExpBuffer support code is in libpq...) >> Late reply, but I don't see any way we could fix this easily. > To me it seems like mostly a case of chasing down all the places where > this happens. It's not impossible to do; it's just a bunch of work > that nobody's gotten excited about doing yet. We've fixed similar > issues in many other cases, IIUC. Well, the problem with what I suspect you're thinking of is that even after we fixed all the existing trouble spots, it would keep on breaking. Unless we found some mechanical way to warn about unsafe coding; which in itself would be more work than I want to put into this. However, a plan B occurs to me: what about preventing pg_dump from using libpq's copy of PQExpBuffer? IIUC, a copy of the PQExpBuffer code statically linked into pg_dump would be free of this problem. There's not so much code there that this would be an intolerable price to pay. (Besides, we could probably arrange for the extra copy to happen only on Windows.) regards, tom lane