On Fri, Dec 6, 2019 at 11:24 AM vignesh C <[email protected]> wrote: > > It is noticed that in all the 4 cases the message "FATAL: terminating > connection due to administrator command" does not 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 the backend process. If the packet is > received before the server closes the connection, the error message is > received in both windows and linux. If the packet is not received before the > server closes the connection, the error message is not received in 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 the client is active, whereas in case of inactive clients it does > not solves the problem. One other thought that we had was to simultaneously > check the connection from psql, when we are waiting for query input in > gets_interactive function or have a separate thread to check the connection > status periodically, this might work only in case of psql but will not work > for application which uses libpq. Amit had also suggested one solution in > [4], where he proposed 'I have also tried calling closesocket() explicitly in > our function socket_close which has changed the error message to "could not > receive data from 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
