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

Commit91d97f0

Browse files
committed
Don't dump core when destroying an unused ParallelContext.
If a transaction or subtransaction creates a ParallelContext but endswithout calling InitializeParallelDSM, the previous code wouldseg fault. Fix that.
1 parent75096c4 commit91d97f0

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

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

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -513,14 +513,17 @@ DestroyParallelContext(ParallelContext *pcxt)
513513
dlist_delete(&pcxt->node);
514514

515515
/* Kill each worker in turn, and forget their error queues. */
516-
for (i=0;i<pcxt->nworkers;++i)
516+
if (pcxt->worker!=NULL)
517517
{
518-
if (pcxt->worker[i].bgwhandle!=NULL)
519-
TerminateBackgroundWorker(pcxt->worker[i].bgwhandle);
520-
if (pcxt->worker[i].error_mqh!=NULL)
518+
for (i=0;i<pcxt->nworkers;++i)
521519
{
522-
pfree(pcxt->worker[i].error_mqh);
523-
pcxt->worker[i].error_mqh=NULL;
520+
if (pcxt->worker[i].bgwhandle!=NULL)
521+
TerminateBackgroundWorker(pcxt->worker[i].bgwhandle);
522+
if (pcxt->worker[i].error_mqh!=NULL)
523+
{
524+
pfree(pcxt->worker[i].error_mqh);
525+
pcxt->worker[i].error_mqh=NULL;
526+
}
524527
}
525528
}
526529

@@ -550,7 +553,7 @@ DestroyParallelContext(ParallelContext *pcxt)
550553
{
551554
BgwHandleStatusstatus;
552555

553-
if (pcxt->worker[i].bgwhandle==NULL)
556+
if (pcxt->worker==NULL||pcxt->worker[i].bgwhandle==NULL)
554557
continue;
555558

556559
/*

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp