New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set the SO_KEEPALIVE option on the client TCP socket [CORE2752] #3147
Comments
Commented by: @AlexPeshkoff Vladimir, SO_KEEPALIVE is used by server sockets to detect dead clients. I suppose you wish to check for dead server in your case. But client (unlike server) always can check, is server alife or not, using any API call (information, for example). Next, when server socket detects dead client, it has absolutely clear idea what to do - release all resources, required for that client. Can you explain what should be done in your example? Stop replication thread? Not sure this is good idea. |
Modified by: @AlexPeshkoffassignee: Alexander Peshkov [ alexpeshkoff ] |
Commented by: Vladimir Arkhipov (arkinform) Yes, I wish to check for dead server (rather for connection abort). In my case replication thread is freezing for a long time (usually for unlimited time) and I want to detect it. Of course I can "ping" the remote port in separated thread, but connection may be already restored, anyway my exist database connection may be dead. More, I need to free this thread but closing database connection from another thread is not very safe. In addition I have many databases (about 30) and I need database pooling for each thread. And freezing prevent from normal processing of next databases in pool. And in this case SO_KEEPALIVE will be applicable. |
Commented by: Vladimir Arkhipov (arkinform) What about resolution for this issue? |
Commented by: @dyemanov I'm scheduling this ticket for v3.0, as v2.5 is already frozen for changes. BTW, I'm not really convinced this is a bug per se. It more looks like an improvement request. |
Modified by: @dyemanovFix Version: 3.0 Alpha 1 [ 10331 ] |
Commented by: @AlexPeshkoff I'm still not absolutely sure that this will work. Keepalive packets are used to check for presence of the other side of network socket when there is *no* network activity on the socket. When replication request from server to another server is sent, it means presence of activity on the socket, therefore generic IP timeouts should work here. |
Commented by: Vladimir Arkhipov (arkinform) Is it possible to use SO_RCVTIMEO and SO_SNDTIMEO socket options instead of SO_KEEPALIVE ?! But on some platforms these options may be unsupported. BTW, I agree that this issue is improvement, sorry :) |
Modified by: @dyemanovissuetype: Bug [ 1 ] => Improvement [ 4 ] |
Commented by: Frank Schlottmann-Goedde (fsg) In the meantime, until this has made it into the official codebase you may use <http://libkeepalive.sourceforge.net/> for a workaround. |
Modified by: @dyemanovassignee: Alexander Peshkov [ alexpeshkoff ] => Dmitry Yemanov [ dimitr ] |
Modified by: @dyemanovstatus: Open [ 1 ] => Resolved [ 5 ] resolution: Fixed [ 1 ] Fix Version: 2.5.1 [ 10333 ] |
Modified by: @dyemanovsummary: Add an ability to set SO_KEEPALIVE option on client socket => Set the SO_KEEPALIVE option on the client TCP socket |
Commented by: Vladimir Arkhipov (arkinform) Can you append timeout parameters for KeepAlive sockets in firebird.conf for server and fbclient API for clients? |
Commented by: @dyemanov These settings are system-wise, they don't belong exclusively to Firebird. So changing them at runtime (what may require admin rights, BTW) sounds like a bad idea. |
Commented by: Vladimir Arkhipov (arkinform) I don't suggest to change system settings. |
Commented by: @dyemanov I'm not so sure regarding Linux and especially other unices. |
Commented by: @dyemanov After some googling, it looks like IPPROTO_TCP + TCP_KEEPINTVL might make it possible. Not sure it's supported in all platforms though. |
Commented by: Vladimir Arkhipov (arkinform) I think if it can be done in Windows and all Linux then this is sufficient for introducing this feature in Firebird. But it is your decision :) |
Modified by: @pcisarstatus: Resolved [ 5 ] => Closed [ 6 ] |
Modified by: @pavel-zotovQA Status: No test |
Modified by: @pavel-zotovstatus: Closed [ 6 ] => Closed [ 6 ] QA Status: No test => Cannot be tested |
Submitted by: Vladimir Arkhipov (arkinform)
It will be useful for server applications, which connects to remote firebird servers (for example, replication servers)
The text was updated successfully, but these errors were encountered: