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

Commite46753e

Browse files
committed
Fix cache flush hazard in cache_record_field_properties().
We need to increment the refcount on the composite type's cached tupledescriptor while we do lookups of its column types. Otherwise a cacheflush could occur and release the tuple descriptor before we're done withit. This fails reliably with -DCLOBBER_CACHE_ALWAYS, but the odds of afailure in a production build seem rather low (since the pfree'd descriptortypically wouldn't get scribbled on immediately). That may explain thelack of any previous reports. Buildfarm issue noted by Christian Ullrich.Back-patch to 9.1 where the bogus code was added.
1 parent219ef8e commite46753e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

‎src/backend/utils/cache/typcache.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -578,6 +578,9 @@ cache_record_field_properties(TypeCacheEntry *typentry)
578578
load_typcache_tupdesc(typentry);
579579
tupdesc=typentry->tupDesc;
580580

581+
/* Must bump the refcount while we do additional catalog lookups */
582+
IncrTupleDescRefCount(tupdesc);
583+
581584
/* Have each property if all non-dropped fields have the property */
582585
newflags= (TCFLAGS_HAVE_FIELD_EQUALITY |
583586
TCFLAGS_HAVE_FIELD_COMPARE);
@@ -601,6 +604,8 @@ cache_record_field_properties(TypeCacheEntry *typentry)
601604
break;
602605
}
603606
typentry->flags |=newflags;
607+
608+
DecrTupleDescRefCount(tupdesc);
604609
}
605610
typentry->flags |=TCFLAGS_CHECKED_FIELD_PROPERTIES;
606611
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp