Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryrHm-000qan-DM for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Apr 2024 10:52:34 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1ryrHk-001IMI-7O for pgsql-hackers@arkaria.postgresql.org; Mon, 22 Apr 2024 10:52:32 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ryrHj-001IM3-T5 for pgsql-hackers@lists.postgresql.org; Mon, 22 Apr 2024 10:52:31 +0000 Received: from mail-wm1-x331.google.com ([2a00:1450:4864:20::331]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ryrHc-002K1o-Rt for pgsql-hackers@lists.postgresql.org; Mon, 22 Apr 2024 10:52:31 +0000 Received: by mail-wm1-x331.google.com with SMTP id 5b1f17b1804b1-41a0979b9aeso9806895e9.3 for ; Mon, 22 Apr 2024 03:52:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713783143; x=1714387943; darn=lists.postgresql.org; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to; bh=vDqaK7O5D95JSS0H40oEppTu8Kpa/xof62XOhyCcq2g=; b=cLhkFuT7xJ+gO+C8/b1yWIZ6HG4UiqJtRVLAQ8YCc/JGuiCFf1I6l6Y5uqVCidp7aQ Fp3N0AP9KABU5gFtu08F3LtMnghvIblcPR8EoSkdFHsF5q7xUsnwWSLgueEH8j3FJeWm vgE9sBhOiU/BDuulry6PBVvtCCrPVnfUPfZJnzlpJNnfZk0KPWfKKbzFTggJ6xxdsUid LApU94GBkelRiH/VKKtOqd2bFtH84T97KRpXJgMejsiCyXuhBMzR2rwacn28HJbYddbW 1FFhq1sz6hkXDmsJFZzo91XQAuLNnSVj5LAcwpLN+qOHvSMQFDS/SrZrB29bBi3QxKFY yDYw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713783143; x=1714387943; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vDqaK7O5D95JSS0H40oEppTu8Kpa/xof62XOhyCcq2g=; b=KNfCfztVPIn41xB1b6Jch+WtG1XZkvUj95JnX85houf9dDUor5kytsBdzyzdxmn8e2 QyUh1qXMraVykGaXvRvG9PScq1z9akxf53vCZRiK6eUMyWtT4KxMMSD3QPeXyZ+lG7uz szWBXQl+uw38HkjErL7EdkGIvaTs2RiMmDhSoPrCHHmKWiBgod7TV4W2kFi4b36OpyDj S9+7rvMEsR9aLkhWGaWfrm9Kzi0BJG7FIxoT6FJUj4+cl0gq0Ms2DUyjL9zYuzqwJivi 1tHpxYSdQHFPtbsHVGMjq7ifC5M4R7aPCosSoepyGu4l4qekH1dFMSdiRsn9Ily+3eqc IIfg== X-Gm-Message-State: AOJu0YwAurp0mDcm0i0ut3HA53NanrQx2IAO2kQJq6MVhchW+aSl7/Ye pS6aTKlPj7b7WKu+jDTPcK3+F1k++qWl+ZDhGbex4hZdaTl1dma1 X-Google-Smtp-Source: AGHT+IHQWacSF9elNM/VpTeOmiBMuOG8HN5/eQIumMnjCNr1pTKwaBMf6bXJ9/EXP2LPBZhGzk+ADA== X-Received: by 2002:a05:600c:54c4:b0:417:d4f6:22eb with SMTP id iw4-20020a05600c54c400b00417d4f622ebmr7705865wmb.24.1713783143271; Mon, 22 Apr 2024 03:52:23 -0700 (PDT) Received: from ip-10-97-1-34.eu-west-3.compute.internal (ec2-15-236-134-5.eu-west-3.compute.amazonaws.com. [15.236.134.5]) by smtp.gmail.com with ESMTPSA id jg23-20020a05600ca01700b004189cf6bd6esm19602614wmb.22.2024.04.22.03.52.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Apr 2024 03:52:22 -0700 (PDT) Date: Mon, 22 Apr 2024 10:52:21 +0000 From: Bertrand Drouvot To: Alexander Lakhin Cc: pgsql-hackers@lists.postgresql.org Subject: Re: Avoid orphaned objects dependencies, take 3 Message-ID: References: MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi, On Mon, Apr 22, 2024 at 01:00:00PM +0300, Alexander Lakhin wrote: > Hi Bertrand, > > 22.04.2024 11:45, Bertrand Drouvot wrote: > > Hi, > > > > This new thread is a follow-up of [1] and [2]. > > > > Problem description: > > > > We have occasionally observed objects having an orphaned dependency, the > > most common case we have seen is functions not linked to any namespaces. > > > > ... > > > > Looking forward to your feedback, > > This have reminded me of bug #17182 [1]. Thanks for the link to the bug! > Unfortunately, with the patch applied, the following script: > > for ((i=1;i<=100;i++)); do >   ( { for ((n=1;n<=20;n++)); do echo "DROP SCHEMA s;"; done } | psql ) >psql1.log 2>&1 & >   echo " > CREATE SCHEMA s; > CREATE FUNCTION s.func1() RETURNS int LANGUAGE SQL AS 'SELECT 1;'; > CREATE FUNCTION s.func2() RETURNS int LANGUAGE SQL AS 'SELECT 2;'; > CREATE FUNCTION s.func3() RETURNS int LANGUAGE SQL AS 'SELECT 3;'; > CREATE FUNCTION s.func4() RETURNS int LANGUAGE SQL AS 'SELECT 4;'; > CREATE FUNCTION s.func5() RETURNS int LANGUAGE SQL AS 'SELECT 5;'; >   "  | psql >psql2.log 2>&1 & >   wait >   psql -c "DROP SCHEMA s CASCADE" >psql3.log > done > echo " > SELECT pg_identify_object('pg_proc'::regclass, pp.oid, 0), pp.oid FROM pg_proc pp >   LEFT JOIN pg_namespace pn ON pp.pronamespace = pn.oid WHERE pn.oid IS NULL" | psql > > still ends with: > server closed the connection unexpectedly >         This probably means the server terminated abnormally >         before or while processing the request. > > 2024-04-22 09:54:39.171 UTC|||662633dc.152bbc|LOG:  server process (PID > 1388378) was terminated by signal 11: Segmentation fault > 2024-04-22 09:54:39.171 UTC|||662633dc.152bbc|DETAIL:  Failed process was > running: SELECT pg_identify_object('pg_proc'::regclass, pp.oid, 0), pp.oid > FROM pg_proc pp >       LEFT JOIN pg_namespace pn ON pp.pronamespace = pn.oid WHERE pn.oid IS NULL > Thanks for sharing the script. That's weird, I just launched it several times with the patch applied and I'm not able to see the seg fault (while I can see it constently failing on the master branch). Are you 100% sure you tested it against a binary with the patch applied? Regards, -- Bertrand Drouvot PostgreSQL Contributors Team RDS Open Source Databases Amazon Web Services: https://aws.amazon.com