Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jnPic-0005P7-GP for pgsql-general@arkaria.postgresql.org; Mon, 22 Jun 2020 16:54:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jnPib-0000uV-E4 for pgsql-general@arkaria.postgresql.org; Mon, 22 Jun 2020 16:54:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jnPib-0000uN-5W for pgsql-general@lists.postgresql.org; Mon, 22 Jun 2020 16:54:49 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jnPiY-0001DY-OV for pgsql-general@lists.postgresql.org; Mon, 22 Jun 2020 16:54:48 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 05MGscUV2080967; Mon, 22 Jun 2020 12:54:38 -0400 From: Tom Lane To: Flaris Feller cc: "Peter J. Holzer" , pgsql-general@lists.postgresql.org Subject: Re: ERROR: invalid memory alloc request size 18446744073709551613 In-reply-to: References: <20200622153315.GA25644@hjp.at> Comments: In-reply-to Flaris Feller message dated "Mon, 22 Jun 2020 13:44:17 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-ID: <2080965.1592844878.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Mon, 22 Jun 2020 12:54:38 -0400 Message-ID: <2080966.1592844878@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Flaris Feller writes: > Em seg., 22 de jun. de 2020 =C3=A0s 12:33, Peter J. Holzer > escreveu: >> On 2020-06-22 11:13:33 -0300, Flaris Feller wrote: >>> When using Postgres 9.6.15 on "CentOS Linux release 7.5.1804 (Core)" o= n >>> Intel x86_64 I noticed "invalid memory alloc request size" error at Po= stgreSQL >>> logs. >> That's 2**64 - 3. So probably the size of some object is (erroneously) >> computed as -3 bytes. Yeah. I don't recall the bit-level details offhand, but this is an extremely common symptom of a corrupted length word in a variable-length field. The usual approach is to try to isolate which row or rows contains corrupt data and then delete it. I'm not aware of any tools for doing that automatically, but you can usually home in on a bad row by a process of binary search, eg testing how many rows you can fetch without seeing the error. Also "select * from mytab where ctid =3D '(m,n)'" is useful for probing individual rows, once you get close to the problem area. regards, tom lane