Re: closesocket behavior in different platforms
От | vignesh C |
---|---|
Тема | Re: closesocket behavior in different platforms |
Дата | |
Msg-id | CALDaNm3VSov1ybQ0n2cqZaP5f6KyA-rwZ59Qrp1rAR9mV=zXKg@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: closesocket behavior in different platforms (Amit Kapila <amit.kapila16@gmail.com>) |
Ответы |
Re: closesocket behavior in different platforms
Re: closesocket behavior in different platforms |
Список | pgsql-hackers |
On Tue, Jan 21, 2020 at 11:22 AM Amit Kapila <amit.kapila16@gmail.com> wrote: > > 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" doesnot appear 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 thebackend process. 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]. > Thanks for your review and suggestion. I have made a patch based on similar lines. Attached patch has the doc update with the explanation. Thoughts? Regards, Vignesh EnterpriseDB: http://www.enterprisedb.com
Вложения
В списке pgsql-hackers по дате отправления: