pg.ddx.io pgsql-bugs@postgresql.org mailing list archivehelp / color / mirror / Atom feed
From: Andrew Gierth <andrew@tao11.riddles.org.uk>
To: pgsql-bugs@lists.postgresql.org
To: do.daisuke@gmail.com
Subject: Re: BUG #15379: Release process of the index access method is not called when an error occurs.
Date: Tue, 11 Sep 2018 06:30:35 +0100
Message-ID: <877ejsr4mw.fsf@news-spur.riddles.org.uk> (raw)
In-Reply-To: <153664176892.23144.11307374381540165215@wrigleys.postgresql.org>
References: <153664176892.23144.11307374381540165215@wrigleys.postgresql.org>
>>>>> "PG" == PG Bug reporting form <noreply@postgresql.org> writes:
PG> When an error occurs in `SELECT FOR UPDATE` using an index, release
PG> process of the index access method is not called.
That's true in general for all errors.
PG> At this time, the index access method ambeginscan() is called but
PG> since amendscan() is not called, ambeginscan() can not properly
PG> release the resource set in IndexScanDesc::opaque.
Any resources that you allocate for the index scan have to be such that
they get released automatically even on error paths: memory allocation
is handled by the memory context system, things like buffer pins are
handled by the ResourceOwner mechanism; locks are released by
(sub)transaction abort.
PG> Solution:
PG> For example, if an error occurs while calling PortalRun() in
PG> exec_simple_query() of src/backend/tcop/postgresq.c, amendscan()
PG> will not be called because PortalDrop() will not be called.
PG> Therefore, it is good to postpone even when an error occurs as
PG> follows.
Your solution is hopeless for many reasons, not least of which is the
fact that an error while running the portal will cause it to be marked
as failed, and executor shutdown will not be run for a failed portal.
--
Andrew (irc:RhodiumToad)
view thread (2+ messages)
Message-ID: <877ejsr4mw.fsf@news-spur.riddles.org.uk> Permalink: ../877ejsr4mw.fsf@news-spur.riddles.org.uk/ Also on: postgresql.org/message-id/877ejsr4mw.fsf@news-spur.riddles.org.uk ·
reply
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Reply to all the recipients from your mail client; the link fills in the headers below: reply via email Some clients, webmail especially, drop In-Reply-To and References from a link, and the reply then starts a new thread: use the mbox below. To: pgsql-bugs@postgresql.org Cc: andrew@tao11.riddles.org.uk, do.daisuke@gmail.com Subject: Re: BUG #15379: Release process of the index access method is not called when an error occurs. In-Reply-To: <877ejsr4mw.fsf@news-spur.riddles.org.uk> References: <153664176892.23144.11307374381540165215@wrigleys.postgresql.org> <877ejsr4mw.fsf@news-spur.riddles.org.uk> * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions for how to clone and mirror all data and code used for this inbox