ERROR: invalid memory alloc in Pg 9.6.6

From: Don Seiler <don(at)seiler(dot)us>
To: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: ERROR: invalid memory alloc in Pg 9.6.6
Date: 2018-04-11 19:44:55
Message-ID: CAHJZqBDOYcBUXxmQEWoYiPfwNooumTVv27bnPPOA_JuTSWcZ6A@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Started seeing "invalid memory alloc" errors in a non-production DB (9.6.6)
all of a sudden this afternoon. It's running on CentOS 7.4 on VMWare.

I ran a pg_dump on that DB and got this error almost immediately:

pg_dump: [archiver (db)] query failed: ERROR: invalid memory alloc request
size 8830452760576
pg_dump: [archiver (db)] query was: SELECT at.attname, (SELECT
pg_catalog.array_agg(acl ORDER BY row_n) FROM (SELECT acl, row_n FROM
pg_catalog.unnest(coalesce(at.attacl,pg_catalog.acldefault('c',c.relowner)))
WITH ORDINALITY AS perm(acl,row_n) WHERE NOT EXISTS ( SELECT 1 FROM
pg_catalog.unnest(coalesce(pip.initprivs,pg_catalog.acldefault('c',c.relowner)))
AS init(init_acl) WHERE acl = init_acl)) as foo) AS attacl, (SELECT
pg_catalog.array_agg(acl ORDER BY row_n) FROM (SELECT acl, row_n FROM
pg_catalog.unnest(coalesce(pip.initprivs,pg_catalog.acldefault('c',c.relowner)))
WITH ORDINALITY AS initp(acl,row_n) WHERE NOT EXISTS ( SELECT 1 FROM
pg_catalog.unnest(coalesce(at.attacl,pg_catalog.acldefault('c',c.relowner)))
AS permp(orig_acl) WHERE acl = orig_acl)) as foo) AS rattacl, NULL AS
initattacl, NULL AS initrattacl FROM pg_catalog.pg_attribute at JOIN
pg_catalog.pg_class c ON (at.attrelid = c.oid) LEFT JOIN
pg_catalog.pg_init_privs pip ON (at.attrelid = pip.objoid AND pip.classoid
= 'pg_catalog.pg_class'::pg_catalog.regclass AND at.attnum = pip.objsubid)
WHERE at.attrelid = '16445700'::pg_catalog.oid AND NOT at.attisdropped AND
((SELECT pg_catalog.array_agg(acl ORDER BY row_n) FROM (SELECT acl, row_n
FROM
pg_catalog.unnest(coalesce(at.attacl,pg_catalog.acldefault('c',c.relowner)))
WITH ORDINALITY AS perm(acl,row_n) WHERE NOT EXISTS ( SELECT 1 FROM
pg_catalog.unnest(coalesce(pip.initprivs,pg_catalog.acldefault('c',c.relowner)))
AS init(init_acl) WHERE acl = init_acl)) as foo) IS NOT NULL OR (SELECT
pg_catalog.array_agg(acl ORDER BY row_n) FROM (SELECT acl, row_n FROM
pg_catalog.unnest(coalesce(pip.initprivs,pg_catalog.acldefault('c',c.relowner)))
WITH ORDINALITY AS initp(acl,row_n) WHERE NOT EXISTS ( SELECT 1 FROM
pg_catalog.unnest(coalesce(at.attacl,pg_catalog.acldefault('c',c.relowner)))
AS permp(orig_acl) WHERE acl = orig_acl)) as foo) IS NOT NULL OR NULL IS
NOT NULL OR NULL IS NOT NULL)ORDER BY at.attnum

I ran pg_catcheck and it came back just fine:
progress: done (0 inconsistencies, 0 warnings, 0 errors)

The web hits I found on this seem to expect the error to hit on the COPY
command that dumps the data, but we seem to be hitting this error way ahead
of that. I ran a pg_dump on the other DBs in the cluster and it finished
without errors.

While this isn't production, I'd like to salvage things if possible (as
well as try to determine why this happened). I can take a statement that
hit the error from the log and run it myself in psql and it will return
fine. I can only seem to hit this error when I run the pg_dump, but it's
happening very frequently in this pre-prod DB.

Any hope here?

--
Don Seiler
www.seiler.us

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Don Seiler 2018-04-11 19:47:04 Re: ERROR: invalid memory alloc in Pg 9.6.6
Previous Message Peter Eisentraut 2018-04-09 18:09:06 Re: How to monitor logical replication initial sync?