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

Commit2307868

Browse files
committed
Does it help to wait before reattaching?
Revert the map/unmap dance I tried in commit73042b8; that helpsnot at all.Instead, speculate that the unwanted allocation is being done onanother thread, and thus timing variations explain the apparentunpredictability. Temporarily add a 1-second sleep before theVirtualFree call, in hopes that any such other threads willquiesce and not jog our elbow.This is obviously not a desirable long-term fix, but as a means ofinvestigation it seems useful.Discussion:https://postgr.es/m/25495.1524517820@sss.pgh.pa.us
1 parent73042b8 commit2307868

File tree

1 file changed

+4
-15
lines changed

1 file changed

+4
-15
lines changed

‎src/backend/port/win32_shmem.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -456,22 +456,11 @@ PGSharedMemoryReAttach(void)
456456
/* Ensure buf is big enough that it won't grow mid-operation */
457457
initStringInfo(&buf);
458458
enlargeStringInfo(&buf,128*1024);
459+
/* ... and let's just be sure all that space is committed */
460+
memset(buf.data,0,buf.maxlen);
459461

460-
dumpmem(&buf,"beginning PGSharedMemoryReAttach");
461-
462-
hdr= (PGShmemHeader*)MapViewOfFileEx(UsedShmemSegID,FILE_MAP_READ |FILE_MAP_WRITE,0,0,0,NULL);
463-
if (hdr)
464-
{
465-
if (!UnmapViewOfFile(hdr))
466-
elog(LOG,"could not unmap temporary view of shared memory: error code %lu",
467-
GetLastError());
468-
}
469-
else
470-
{
471-
/* This isn't fatal, just unpromising ... */
472-
elog(LOG,"could not attach to shared memory (key=%p) at any address: error code %lu",
473-
UsedShmemSegID,GetLastError());
474-
}
462+
/* Test: see if this lets the process address space quiesce */
463+
pg_usleep(1000000L);
475464

476465
dumpmem(&buf,"before VirtualFree");
477466

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp