Re: closesocket behavior in different platforms
От | Amit Kapila |
---|---|
Тема | Re: closesocket behavior in different platforms |
Дата | |
Msg-id | CAA4eK1JDkzAdDbFnRnq3Tbcwk16SCSViLSfyBMs3vV2puCrj4A@mail.gmail.com обсуждение исходный текст |
Ответ на | closesocket behavior in different platforms (vignesh C <vignesh21@gmail.com>) |
Ответы |
Re: closesocket behavior in different platforms
|
Список | pgsql-hackers |
On Fri, Dec 6, 2019 at 11:24 AM vignesh C <vignesh21@gmail.com> wrote: > > It is noticed that in all the 4 cases the message "FATAL: terminating connection due to administrator command" does notappear in windows. > > However the following message is present in the server log file: > FATAL: terminating connection due to administrator command > > The reason for this looks like: > When the server closes a connection, it sends the ErrorResponse packet, and then closes the socket and terminates the backendprocess. If the packet is received before the server closes the connection, the error message is received in bothwindows and linux. If the packet is not received before the server closes the connection, the error message is not receivedin case of windows where as in linux it is received. > > There have been a couple of discussion earlier also on this [1] & [2], but we could not find any alternate solution. > > One of the options that msdn suggests in [3] is to use SO_LINGER option, we had tried this option with no luck in solving.One other thing that we had tried was to sleep for 1 second before closing the socket, this solution works if theclient is active, whereas in case of inactive clients it does not solves the problem. One other thought that we had wasto simultaneously check the connection from psql, when we are waiting for query input in gets_interactive function orhave a separate thread to check the connection status periodically, this might work only in case of psql but will not workfor application which uses libpq. Amit had also suggested one solution in [4], where he proposed 'I have also tried callingclosesocket() explicitly in our function socket_close which has changed the error message to "could not receive datafrom server: Software caused connection abort (0x00002745/10053)".' > Based on previous investigation and information in this email, I don't see anything we can do about this. > Should we add some documentation for the above behavior. > That sounds reasonable to me. Any proposal for the same? One idea could be to add something like "Client Disconnection Problems" after the "Client Connection Problems" section in docs [1]. Anybody else has any better suggestions on this topic? [1] - https://www.postgresql.org/docs/devel/server-start.html -- With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: