Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit f1ca515

Browse files
committed
Force pgwin32_recv into nonblock mode when called from pgstat.c.
This should get rid of the usage of pgwin32_waitforsinglesocket entirely, and perhaps thereby remove the race condition that's evidently still present on some versions of Windows. The previous arrangement was a bit unsafe anyway, since waiting at the recv() would not allow pgstat to notice postmaster death.
1 parent f15c2ea commit f1ca515

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

src/backend/postmaster/pgstat.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3117,9 +3117,21 @@ PgstatCollectorMain(int argc, char *argv[])
31173117
/*
31183118
* Try to receive and process a message. This will not block,
31193119
* since the socket is set to non-blocking mode.
3120+
*
3121+
* XXX On Windows, we have to force pgwin32_recv to cooperate.
3122+
* This is extremely broken and should be fixed someday.
31203123
*/
3124+
#ifdef WIN32
3125+
pgwin32_noblock = 1;
3126+
#endif
3127+
31213128
len = recv(pgStatSock, (char *) &msg,
31223129
sizeof(PgStat_Msg), 0);
3130+
3131+
#ifdef WIN32
3132+
pgwin32_noblock = 0;
3133+
#endif
3134+
31233135
if (len < 0)
31243136
{
31253137
if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)

0 commit comments

Comments
 (0)