mirror of
https://github.com/postgres/postgres.git
synced 2025-12-15 00:03:53 -05:00
Avoid server crash when worker registration fails at execution time.
The previous coding attempts to destroy the DSM in this case, but child nodes might have stored data there and still be holding onto pointers in this case. So don't do that. Also, free the reader array instead of leaking it. Extracted from two different patch versions both by Amit Kapila.
This commit is contained in:
parent
74d0d5f3eb
commit
6c878a7553
@ -190,7 +190,7 @@ ExecGather(GatherState *node)
|
||||
|
||||
/* No workers? Then never mind. */
|
||||
if (!got_any_worker)
|
||||
ExecShutdownGather(node);
|
||||
ExecShutdownGatherWorkers(node);
|
||||
}
|
||||
|
||||
/* Run plan locally if no workers or not single-copy. */
|
||||
@ -402,6 +402,8 @@ ExecShutdownGatherWorkers(GatherState *node)
|
||||
|
||||
for (i = 0; i < node->nreaders; ++i)
|
||||
DestroyTupleQueueReader(node->reader[i]);
|
||||
|
||||
pfree(node->reader);
|
||||
node->reader = NULL;
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user