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 1kFege-0007ZV-FA for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Sep 2020 14:33:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kFegd-0002N3-3Z for pgsql-bugs@arkaria.postgresql.org; Tue, 08 Sep 2020 14:33:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kFegc-0002Mw-Te for pgsql-bugs@lists.postgresql.org; Tue, 08 Sep 2020 14:33:30 +0000 Received: from mail-qv1-xf44.google.com ([2607:f8b0:4864:20::f44]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kFega-00080J-Eu for pgsql-bugs@lists.postgresql.org; Tue, 08 Sep 2020 14:33:30 +0000 Received: by mail-qv1-xf44.google.com with SMTP id b13so7904141qvl.2 for ; Tue, 08 Sep 2020 07:33:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=kwkoXN1yCy43DL01uGj1KfkHs5c4xlTlAQW6Y5036ok=; b=vzP7SHf3Rr40nY+0pYYplDEXrsSpuCaX4veav16Uc9nNz8qsWA955dXmzwl1yCc6mV APWfUs1fv7fhZgI607Bw2CK2bUBiYfcQx626cTAaSCDQM4bEKRKoe6aj63z+hQo/cj/G rE4wsFRxHxvj+Ag8VdUABbkVq0MKLcB6jLRMT1TaGqeUvlpzUYNH+0pJIHt//9VsMWxW UxS7aru72DkfZoJBMVTpr81gijUV6cxNouYzkbWSr6ndt+zKWxEhhWFD5Grp3C6Qmxj5 jWHYCBZq2/nL2iKkkMzSDKS2EUP3lh48g7pq8EnqaRmTRJptBhSRsiPb7UMHPKJwiX2p vllA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=kwkoXN1yCy43DL01uGj1KfkHs5c4xlTlAQW6Y5036ok=; b=NI2CgcXZ0KHnBhvf7tB06hRwSnMckKoGFPi4QWJIS55lm9db4WSfx+o6hscta5qvL1 iX6PjhtbqVu2VhPKB/tpkCOv0klP8esY6E1FnFrZjrUjts8iTdLHqBEYezJLNdPhbv57 DeV/OceCqSXVM+6wSwHVQk38dK5lv6sckI1I15lE0cjTSVVa5sSzTMCV2SR1BBodz5ze cw0AcQdSU4n0v1msgeCxKkUCX7L4LKKI44YV5qXXq0Fqz5933wWdikEQthtWERcmvZAM 9pvtVcCVC9TuG278e6MB3JjV7v5DgFSZ8w4a+dBoUcoGvz13enjtr/Wepsxl3R+mbEQT SPTg== X-Gm-Message-State: AOAM532am3yvq0Hgz4gPkywuBjNPlWKVEp1wOpFFGrLfdFI89qHkoCuY 0Ii3fyvaLOULJXb3aww1gmobHg== X-Google-Smtp-Source: ABdhPJwzE6EncxZLSZRR6y+WL3dSD4N0PfxPXm0tViIBhu97KWdZsB/HwXBw/01LwIy2GmkPSqPxdw== X-Received: by 2002:ad4:56a6:: with SMTP id bd6mr338489qvb.17.1599575606642; Tue, 08 Sep 2020 07:33:26 -0700 (PDT) Received: from perhan.alvh.no-ip.org ([190.95.19.47]) by smtp.gmail.com with ESMTPSA id h5sm10612782qkg.115.2020.09.08.07.33.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Sep 2020 07:33:25 -0700 (PDT) Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 39DF42A1007; Tue, 8 Sep 2020 11:33:24 -0300 (-03) Date: Tue, 8 Sep 2020 11:33:24 -0300 From: Alvaro Herrera To: Jehan-Guillaume de Rorthais Cc: Michael Paquier , pgsql-bugs@lists.postgresql.org Subject: Re: [BUG v13] Crash with event trigger in extension Message-ID: <20200908143324.GA11045@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20200908161511.3e340588@firost> User-Agent: Mutt/1.10.1 (2018-07-13) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2020-Sep-08, Jehan-Guillaume de Rorthais wrote: > It appears that when keeping the event trigger enabled, > currentEventTriggerState might be initiated multiple times: one for the top > level "alter extension ... update", then once per DDL query triggering en event > in the extension update script. I suppose there's no crash because the very > first currentEventTriggerState initialized at top level is overrode by next > ones, each being destroyed in their own context. So at the end of the > extension script, currentEventTriggerState is just destroyed and empty. Hmm. I spent a lot of time making sure the event trigger thing worked correctly in reentrant cases, but I don't think the case of execution of extension scripts was ever considered. So you're right that it might be broken, since it appears not to be thoroughly tested (if at all). -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services