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

Commit5ec8b01

Browse files
committed
MemoryContextCreate: assert parent is valid and different from node.
The case of "node == parent" might seem impossible, since we justallocated the new node. But it's possible if parent is a danglingreference to a recently-deleted context. In fact, given aset.c'shabit of recycling contexts, it's actually rather likely if that's so.If we'd had this assertion before, it would have simplified debugginga recently-identified walsender issue.Reported-by: Anthonin Bonnefoy <anthonin.bonnefoy@datadoghq.com>Author: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/CAO6_XqoJA7-_G6t7Uqe5nWF3nj+QBGn4F6Ptp=rUGDr0zo+KvA@mail.gmail.com
1 parent706cbed commit5ec8b01

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

‎src/backend/utils/mmgr/mcxt.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1181,6 +1181,10 @@ MemoryContextCreate(MemoryContext node,
11811181
/* Creating new memory contexts is not allowed in a critical section */
11821182
Assert(CritSectionCount==0);
11831183

1184+
/* Validate parent, to help prevent crazy context linkages */
1185+
Assert(parent==NULL||MemoryContextIsValid(parent));
1186+
Assert(node!=parent);
1187+
11841188
/* Initialize all standard fields of memory context header */
11851189
node->type=tag;
11861190
node->isReset= true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp