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 1rnc42-00E9Nh-W0 for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Mar 2024 10:23:56 +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 1rnc40-002Ck2-OT for pgsql-hackers@arkaria.postgresql.org; Fri, 22 Mar 2024 10:23:53 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rnc40-002Cju-AO for pgsql-hackers@lists.postgresql.org; Fri, 22 Mar 2024 10:23:52 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rnc3w-005pVL-4b for pgsql-hackers@postgresql.org; Fri, 22 Mar 2024 10:23:51 +0000 Received: from mail.postgrespro.ru (unknown [192.168.2.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: a.pyhalov@postgrespro.ru) by mail.postgrespro.ru (Postfix/587) with ESMTPSA id 0AF1AE20FD8; Fri, 22 Mar 2024 13:23:45 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mx2023; t=1711103025; bh=PmltfzWXYi5lJ2PVezdAik8+bI6khNVChD77Vmpqcdc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:User-Agent: Message-ID:From; b=Vtbsh6j/sC/L5xhYvA1YRwkpD24JeReZDSSYeHhg5dfuevd6q0AmNjhETJumEmpRZ AppHjzsvNlxohSz2CakLLWYkm38vQalcx3sSiHtAablw20NjXpznf29VoEnWQL7ook 3QVRvbIlRnI4LV8veiL11hWTRMZ0h2J7sDf6lXu4mC8TgE9bneBfGoqSOYQWL/dCar U08Z+enuoPPU7vBAEaUgmbPbRG6M1EvqPwbkRbjyJbvuOQy5iARThRd015vbvkmeHM OXI6GBmd4R8odUFVzoDYHdCAl66aN5r50o5mAMX1TZuBnIehLsHabkyOEtvKXajnNC PDklatDdNtmfQ== MIME-Version: 1.0 Date: Fri, 22 Mar 2024 13:23:45 +0300 From: Alexander Pyhalov To: Etsuro Fujita Cc: Michael Paquier , Pgsql Hackers Subject: Re: ExecAppendAsyncEventWait() in REL_14_STABLE can corrupt PG_exception_stack In-Reply-To: References: <425fa29a429b21b0332737c42a4fdc70@postgrespro.ru> User-Agent: Roundcube Webmail/1.6.5 Message-ID: X-Sender: a.pyhalov@postgrespro.ru Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Etsuro Fujita писал(а) 2024-03-21 13:59: > On Sun, Feb 25, 2024 at 6:34 PM Etsuro Fujita > wrote: > >> > On Fri, Feb 23, 2024 at 01:21:14PM +0300, Alexander Pyhalov wrote: >> > > Recent commit 555276f8594087ba15e0d58e38cd2186b9f39f6d introduced final >> > > cleanup of node->as_eventset in ExecAppendAsyncEventWait(). >> > > Unfortunately, now this function can return in the middle of TRY/FINALLY >> > > block, without restoring PG_exception_stack. >> > > >> > > We found this while working on our FDW. Unfortunately, I couldn't reproduce >> > > the issue with postgres_fdw, but it seems it is also affected. >> >> I think this would happen when FDWs configure no events; IIRC I think >> while the core allows them to do so, postgres_fdw does not do so, so >> this would never happen with it. > > I was wrong; as you pointed out, this would affect postgres_fdw as > well. See commit 1ec7fca85, which is my commit, but I forgot it > completely. :-( > > As I said before, the patch looks good to me. I tweaked comments in > ExecAppendAsyncEventWait() a bit. Attached is an updated patch. In > the patch I also fixed a confusing comment in a related function in > postgres_fdw.c about handling of the in-process request that might be > useless to process. > > Sorry, it took more time than expected to get back to this thread. > Hi. The updated patch still looks good to me. -- Best regards, Alexander Pyhalov, Postgres Professional