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

Commit75674c7

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 parent357ff66 commit75674c7

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
@@ -277,30 +277,15 @@ socket_close(int code, Datum arg)
277277
secure_close(MyProcPort);
278278

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp