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

Commitfddf45b

Browse files
committed
Plug race in dsa_attach.
With sufficiently bad luck, it was possible for a parallel worker toattempt attach to a DSA area after all other backends have detachedfrom it, which is not legal. If the worker had waited a little longerto get started, the DSM itself would have been destroyed, which is whythis wasn't noticed before.Thomas Munro, per a report from Andreas SeltenreichDiscussion:http://postgr.es/m/87h92g83t3.fsf@credativ.de
1 parent3582b22 commitfddf45b

File tree

1 file changed

+7
-0
lines changed
  • src/backend/utils/mmgr

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1314,6 +1314,13 @@ attach_internal(void *place, dsm_segment *segment, dsa_handle handle)
13141314

13151315
/* Bump the reference count. */
13161316
LWLockAcquire(DSA_AREA_LOCK(area),LW_EXCLUSIVE);
1317+
if (control->refcnt==0)
1318+
{
1319+
/* We can't attach to a DSA area that has already been destroyed. */
1320+
ereport(ERROR,
1321+
(errcode(ERRCODE_OBJECT_NOT_IN_PREREQUISITE_STATE),
1322+
errmsg("could not attach to dsa_area")));
1323+
}
13171324
++control->refcnt;
13181325
LWLockRelease(DSA_AREA_LOCK(area));
13191326

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp