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

Commitb6a97b9

Browse files
committed
Block interrupts during HandleParallelMessages().
As noted by Alvaro, there are CHECK_FOR_INTERRUPTS() calls in the shm_mq.cfunctions called by HandleParallelMessages(). I believe they're allunreachable since we always pass nowait = true, but it doesn't seem likea great idea to assume that no such call will ever be reachable fromHandleParallelMessages(). If that did happen, there would be a risk of arecursive call to HandleParallelMessages(), which it does not appear to bedesigned for --- for example, there's nothing that would preventout-of-order processing of received messages. And certainly such casescannot easily be tested. So let's prevent it by holding off interrupts forthe duration of the function. Back-patch to 9.5 which contains identicalcode.Discussion: <14869.1470083848@sss.pgh.pa.us>
1 parentc4d3a03 commitb6a97b9

File tree

1 file changed

+16
-5
lines changed

1 file changed

+16
-5
lines changed

‎src/backend/access/transam/parallel.c

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -704,14 +704,21 @@ HandleParallelMessages(void)
704704
{
705705
dlist_iteriter;
706706

707+
/*
708+
* This is invoked from ProcessInterrupts(), and since some of the
709+
* functions it calls contain CHECK_FOR_INTERRUPTS(), there is a potential
710+
* for recursive calls if more signals are received while this runs. It's
711+
* unclear that recursive entry would be safe, and it doesn't seem useful
712+
* even if it is safe, so let's block interrupts until done.
713+
*/
714+
HOLD_INTERRUPTS();
715+
707716
ParallelMessagePending= false;
708717

709718
dlist_foreach(iter,&pcxt_list)
710719
{
711720
ParallelContext*pcxt;
712721
inti;
713-
Sizenbytes;
714-
void*data;
715722

716723
pcxt=dlist_container(ParallelContext,node,iter.cur);
717724
if (pcxt->worker==NULL)
@@ -721,13 +728,15 @@ HandleParallelMessages(void)
721728
{
722729
/*
723730
* Read as many messages as we can from each worker, but stop when
724-
* either (1) the error queue goes away, which can happen if we
725-
* receive a Terminate message from the worker; or (2) no more
726-
* messages can be read from the worker without blocking.
731+
* either (1) theworker'serror queue goes away, which can happen
732+
*if wereceive a Terminate message from the worker; or (2) no
733+
*moremessages can be read from the worker without blocking.
727734
*/
728735
while (pcxt->worker[i].error_mqh!=NULL)
729736
{
730737
shm_mq_resultres;
738+
Sizenbytes;
739+
void*data;
731740

732741
res=shm_mq_receive(pcxt->worker[i].error_mqh,&nbytes,
733742
&data, true);
@@ -749,6 +758,8 @@ HandleParallelMessages(void)
749758
}
750759
}
751760
}
761+
762+
RESUME_INTERRUPTS();
752763
}
753764

754765
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp