pgsql: Hold interrupts while running dsm_detach() callbacks.

From: Thomas Munro <tmunro(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Hold interrupts while running dsm_detach() callbacks.
Date: 2021-02-15 01:30:04
Message-ID: E1lBSiC-0006AJ-R4@gemulon.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Hold interrupts while running dsm_detach() callbacks.

While cleaning up after a parallel query or parallel index creation that
created temporary files, we could be interrupted by a statement timeout.
The error handling path would then fail to clean up the files when it
ran dsm_detach() again, because the callback was already popped off the
list. Prevent this hazard by holding interrupts while the cleanup code
runs.

Thanks to Heikki Linnakangas for this suggestion, and also to Kyotaro
Horiguchi, Masahiko Sawada, Justin Pryzby and Tom Lane for discussion of
this and earlier ideas on how to fix the problem.

Back-patch to all supported releases.

Reported-by: Justin Pryzby <pryzby(at)telsasoft(dot)com>
Discussion: https://postgr.es/m/20191212180506.GR2082@telsasoft.com

Branch
------
REL9_6_STABLE

Details
-------
https://git.postgresql.org/pg/commitdiff/8a07e5bd82486b024e58417c09da193c275b13d3

Modified Files
--------------
src/backend/storage/ipc/dsm.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2021-02-15 02:06:43 pgsql: Fix the warnings introduced in commit ce0fdbfe97.
Previous Message Thomas Munro 2021-02-15 01:29:52 pgsql: Hold interrupts while running dsm_detach() callbacks.