Skip to content
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

Firebird.conf Client Connection Settings [DOC87] #6776

Open
firebird-automations opened this issue Jul 3, 2013 · 1 comment
Open

Firebird.conf Client Connection Settings [DOC87] #6776

firebird-automations opened this issue Jul 3, 2013 · 1 comment

Comments

@firebird-automations
Copy link
Collaborator

Submitted by: Andrew Ayre (communicare)

The comments in Firebird.conf for client connection settings include:

#⁠ Normally, Firebird uses SO_KEEPALIVE socket option to keep track of
#⁠ active connections. If you do not like default 2-hour keepalive timeout
#⁠ then adjust your server OS settings appropriately. On UNIX-like OS's,
#⁠ modify contents of /proc/sys/net/ipv4/tcp_keepalive_*. On Windows,
#⁠ follow instrutions of this article:
#⁠ http://support.microsoft.com/default.aspx?kbid=140325

This microsoft article mentioned is only applicable to Windows 95 and NT. It does not seem to be possible to adjust server settings in Windows 7.

Can someone confirm this? I would like to reduce the keepalive timeout from the default 2 hours to 5 mins.

Thanks,
Tom

@mrotteveel mrotteveel transferred this issue from FirebirdSQL/firebird-documentation Apr 25, 2021
@abzalov
Copy link
Contributor

abzalov commented Oct 8, 2021

I will bring this up again.

The suggested settings in the OS (/proc/sys/net/ipv4/tcp_keepalive_* and instrutions of article in Windows (by the way the article is no longer exists at this link)) are global to the OS and affects to all applications. Needed more sophisticated tools to set up Firebird connections.

  1. It would be nice to support the ability to set the following server-side TCP connection options in the configuration file:
  • TCP_KEEPIDDLE
  • TCP_KEEPCNT
  • TCP_KEEPINTVL

If needed a more detailed explanation of the need, then the next article does it well - When TCP sockets refuse to die.

This Oracle document - Dead Connetion Detection describes their configuration approach based on the same TCP options.
In fact, starting from the 12th Oracle they use TCP connection options. Only the TCP_KEEPIDDLE option is configurable (option name SQLNET.EXPIRE_TIME). The rest of the options are fixed and cannot be changed: TCP_KEEPCNT - 10 times and TCP_KEEPINTVL - 6 seconds.

Similarly, Postgres also has the ability to customize these options in the server configuration file postrgres.conf:

  • tcp_keepalives_idle
  • tcp_keepalives_count
  • tcp_keepalives_interval
  1. It would also be nice if on Linux the client side could control the TCP_USER_TIMEOUT option, or in extreme cases it would be possible to somehow get a connection handle so that this option could be applied manually.
    Now in Linux, a client detects a broken connection for a very long time - about 15 minutes. This value is controlled by the OS setting tcp_retries2. But this setting is global and changing it affects all processes.
    To solve this problem, the ability to set the TCP connection option on the client side - TCP_USER_TIMEOUT will help.
    For example, in Postgres, it can be set both in the connection string and applied to the client application manually by receiving a connection socket using PQsocket from libpq.so.

Сan be reproduced with isql:

  1. on client side: connect server_host:/tmp/test.fdb user sysdba password masterkey;
  2. on server side: disconnect the server from the network
  3. on client side: select * from rdb$database;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants