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

Commit213c5aa

Browse files
committed
Revert "graceful shutdown" changes for Windows, in back branches only.
This reverts commits6051857 anded52c37, but only in the backbranches. Further testing has shown that while those changes do fixsome things, they also break others; in particular, it looks likewalreceivers fail to detect walsender-initiated connection closereliably if the walsender shuts down this way. We'll keep trying toimprove matters in HEAD, but it now seems unwise to push these changesinto stable releases.Discussion:https://postgr.es/m/CA+hUKG+OeoETZQ=Qw5Ub5h3tmwQhBmDA=nuNO3KG=zWfUypFAw@mail.gmail.com
1 parentf8807e7 commit213c5aa

File tree

1 file changed

+7
-22
lines changed

1 file changed

+7
-22
lines changed

‎src/backend/libpq/pqcomm.c

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -284,30 +284,15 @@ socket_close(int code, Datum arg)
284284
secure_close(MyProcPort);
285285

286286
/*
287-
* On most platforms, we leave the socket open until the process dies.
288-
* This allows clients to perform a "synchronous close" if they care
289-
* --- wait till the transport layer reports connection closure, and
290-
* you can be sure the backend has exited. Saves a kernel call, too.
287+
* Formerly we did an explicit close() here, but it seems better to
288+
* leave the socket open until the process dies. This allows clients
289+
* to perform a "synchronous close" if they care --- wait till the
290+
* transport layer reports connection closure, and you can be sure the
291+
* backend has exited.
291292
*
292-
* However, that does not work on Windows: if the kernel closes the
293-
* socket it will invoke an "abortive shutdown" that discards any data
294-
* not yet sent to the client. (This is a flat-out violation of the
295-
* TCP RFCs, but count on Microsoft not to care about that.) To get
296-
* the spec-compliant "graceful shutdown" behavior, we must invoke
297-
* closesocket() explicitly. When using OpenSSL, it seems that clean
298-
* shutdown also requires an explicit shutdown() call.
299-
*
300-
* This code runs late enough during process shutdown that we should
301-
* have finished all externally-visible shutdown activities, so that
302-
* in principle it's good enough to act as a synchronous close on
303-
* Windows too. But it's a lot more fragile than the other way.
293+
* We do set sock to PGINVALID_SOCKET to prevent any further I/O,
294+
* though.
304295
*/
305-
#ifdefWIN32
306-
shutdown(MyProcPort->sock,SD_SEND);
307-
closesocket(MyProcPort->sock);
308-
#endif
309-
310-
/* In any case, set sock to PGINVALID_SOCKET to prevent further I/O */
311296
MyProcPort->sock=PGINVALID_SOCKET;
312297
}
313298
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp