diff --git a/src/backend/postmaster/pgstat.c b/src/backend/postmaster/pgstat.c
index cb4377708302f4a407a48b6ca448c805c3700e3d..4c2cc6557235568d1c546e696cc788893862c6d9 100644
--- a/src/backend/postmaster/pgstat.c
+++ b/src/backend/postmaster/pgstat.c
@@ -3117,9 +3117,21 @@ PgstatCollectorMain(int argc, char *argv[])
 			/*
 			 * Try to receive and process a message.  This will not block,
 			 * since the socket is set to non-blocking mode.
+			 *
+			 * XXX On Windows, we have to force pgwin32_recv to cooperate.
+			 * This is extremely broken and should be fixed someday.
 			 */
+#ifdef WIN32
+			pgwin32_noblock = 1;
+#endif
+
 			len = recv(pgStatSock, (char *) &msg,
 					   sizeof(PgStat_Msg), 0);
+
+#ifdef WIN32
+			pgwin32_noblock = 0;
+#endif
+
 			if (len < 0)
 			{
 				if (errno == EAGAIN || errno == EWOULDBLOCK || errno == EINTR)