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 1mgSrK-0008Ap-1F for pgsql-admin@arkaria.postgresql.org; Fri, 29 Oct 2021 14:27:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mgSrH-0005j6-J3 for pgsql-admin@arkaria.postgresql.org; Fri, 29 Oct 2021 14:27:51 +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 1mgSrH-0005ix-9H for pgsql-admin@lists.postgresql.org; Fri, 29 Oct 2021 14:27:51 +0000 Received: from mailout.easymail.ca ([64.68.200.34]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1mgSrE-0003jq-SY for pgsql-admin@lists.postgresql.org; Fri, 29 Oct 2021 14:27:50 +0000 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id D7C6B6C101; Fri, 29 Oct 2021 14:27:46 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at emo05-pco.easydns.vpn Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (emo05-pco.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Raqx5bthxBAJ; Fri, 29 Oct 2021 14:27:46 +0000 (UTC) Received: from smtpclient.apple (unknown [4.28.96.150]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 702466C100; Fri, 29 Oct 2021 14:27:46 +0000 (UTC) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: Segfault during queries From: Scott Ribe In-Reply-To: Date: Fri, 29 Oct 2021 08:27:45 -0600 Cc: pgsql-admin@lists.postgresql.org Content-Transfer-Encoding: quoted-printable Message-Id: References: To: Tyler Brock X-Mailer: Apple Mail (2.3654.120.0.1.13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Of course I cannot say if this is your case, but I've been using PG = since 2004 and every single instance* of a segfault has turned out to be = caused by some 3rd-party extension or other. And yes, the extension was = never related in any way to the query being run, it just corrupted = memory such that PG would die later. So I would audit extensions, and = see if any have been recently added, any could be removed temporarily, = and so on. * It's only 2 or 3 cases in all that time, but still, it was never core = PG. -- Scott Ribe scott_ribe@elevated-dev.com https://www.linkedin.com/in/scottribe/ > On Oct 29, 2021, at 8:05 AM, Tyler Brock = wrote: >=20 > Hi all, >=20 > I keep getting segfaults when running queries against postgresql = replicas. We have an ETL job that hits these nodes with many small = queries (no more than 8 concurrently) and the box has 16 cores and = plenty of I/O and ram. >=20 > However, during this process postgresql segfaults, usually on COPY = commands that have this shape: >=20 > COPY > ( > SELECT row_to_json(t) > FROM ( > SELECT lead_tag."objectId" AS "lead_id", > lead_tag."tag" AS "tag_id" > FROM ( > SELECT "objectId", > = jsonb_array_elements_text("tags") AS tag > FROM "Lead" > WHERE true > AND "Lead"."organization" =3D = 'I6JDWAaZx5' > AND tags IS NOT NULL > AND "Lead"."updatedAt" >=3D = '2015-01-01' > AND "Lead"."updatedAt" < = '2021-10-30T11:05:40.389773+00:00' ) AS lead_tag) t) TO stdout >=20 > Is there anything I can do to prevent this or anything i can look at = to try and diagnose what is happening here? I=E2=80=99m running Postgres = 12.7 and cannot tell if this is a symptom of a bug or just = misconfiguration. >=20 > What I see in the error logs is: >=20 > 2021-10-29 11:08:10 = UTC:172.23.17.171(54332):postgres@postgres:[22200]:ERROR: cache lookup = failed for type 0 > 2021-10-29 11:08:10 = UTC:172.23.17.171(54332):postgres@postgres:[22200]:STATEMENT: COPY = (SELECT ROW_TO_JSON(t) FROM (=E2=80=A6 the query above...) TO STDOUT > 2021-10-29 11:08:10 UTC::@:[19406]:LOG: server process (PID 22200) was = terminated by signal 11: Segmentation fault >=20 >=20 > Any help would be greatly appreciated, thanks! >=20 > -Tyler