Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit4b426f7

Browse files
committed
Hold interrupts while running dsm_detach() callbacks.
While cleaning up after a parallel query or parallel index creation thatcreated temporary files, we could be interrupted by a statement timeout.The error handling path would then fail to clean up the files when itran dsm_detach() again, because the callback was already popped off thelist. Prevent this hazard by holding interrupts while the cleanup coderuns.Thanks to Heikki Linnakangas for this suggestion, and also to KyotaroHoriguchi, Masahiko Sawada, Justin Pryzby and Tom Lane for discussion ofthis and earlier ideas on how to fix the problem.Back-patch to all supported releases.Reported-by: Justin Pryzby <pryzby@telsasoft.com>Discussion:https://postgr.es/m/20191212180506.GR2082@telsasoft.com
1 parent02e7da0 commit4b426f7

File tree

1 file changed

+6
-1
lines changed
  • src/backend/storage/ipc

1 file changed

+6
-1
lines changed

‎src/backend/storage/ipc/dsm.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,8 +720,12 @@ dsm_detach(dsm_segment *seg)
720720
/*
721721
* Invoke registered callbacks. Just in case one of those callbacks
722722
* throws a further error that brings us back here, pop the callback
723-
* before invoking it, to avoid infinite error recursion.
723+
* before invoking it, to avoid infinite error recursion. Don't allow
724+
* interrupts while running the individual callbacks in non-error code
725+
* paths, to avoid leaving cleanup work unfinished if we're interrupted by
726+
* a statement timeout or similar.
724727
*/
728+
HOLD_INTERRUPTS();
725729
while (!slist_is_empty(&seg->on_detach))
726730
{
727731
slist_node*node;
@@ -737,6 +741,7 @@ dsm_detach(dsm_segment *seg)
737741

738742
function(seg,arg);
739743
}
744+
RESUME_INTERRUPTS();
740745

741746
/*
742747
* Try to remove the mapping, if one exists. Normally, there will be, but

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp