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

Commit9b63e98

Browse files
committed
In pgstat.c, use a timeout in WaitLatchOrSocket only on Windows.
We have no need for a timeout here really, but some broken products fromRedmond seem to lose FD_READ events occasionally, and waking up andretrying the recv() is the only known way to work around that. Perhapssomebody will be motivated to figure out a better answer here; but not I.
1 parent5a2bb06 commit9b63e98

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

‎src/backend/postmaster/pgstat.c

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3113,7 +3113,8 @@ PgstatCollectorMain(int argc, char *argv[])
31133113
* Try to receive and process a message. This will not block,
31143114
* since the socket is set to non-blocking mode.
31153115
*
3116-
* XXX On Windows, we have to force pgwin32_recv to cooperate.
3116+
* XXX On Windows, we have to force pgwin32_recv to cooperate,
3117+
* despite the previous use of pg_set_noblock() on the socket.
31173118
* This is extremely broken and should be fixed someday.
31183119
*/
31193120
#ifdefWIN32
@@ -3231,11 +3232,27 @@ PgstatCollectorMain(int argc, char *argv[])
32313232
}/* end of inner message-processing loop */
32323233

32333234
/* Sleep until there's something to do */
3234-
/* XXX should not need a timeout here */
3235+
#ifndefWIN32
3236+
wr=WaitLatchOrSocket(&pgStatLatch,
3237+
WL_LATCH_SET |WL_POSTMASTER_DEATH |WL_SOCKET_READABLE,
3238+
pgStatSock,
3239+
-1L);
3240+
#else
3241+
/*
3242+
* Windows, at least in its Windows Server 2003 R2 incarnation,
3243+
* sometimes loses FD_READ events. Waking up and retrying the recv()
3244+
* fixes that, so don't sleep indefinitely. This is a crock of the
3245+
* first water, but until somebody wants to debug exactly what's
3246+
* happening there, this is the best we can do. The two-second
3247+
* timeout matches our pre-9.2 behavior, and needs to be short enough
3248+
* to not provoke "pgstat wait timeout" complaints from
3249+
* backend_read_statsfile.
3250+
*/
32353251
wr=WaitLatchOrSocket(&pgStatLatch,
32363252
WL_LATCH_SET |WL_POSTMASTER_DEATH |WL_SOCKET_READABLE |WL_TIMEOUT,
32373253
pgStatSock,
3238-
2000L);
3254+
2*1000L/* msec */);
3255+
#endif
32393256

32403257
/*
32413258
* Emergency bailout if postmaster has died. This is to avoid the

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp