FirebirdSQL / firebird

Firebird server, client and tools
https://www.firebirdsql.org/
1.26k stars 217 forks source link

Firebird.conf Client Connection Settings [DOC87] #6776

Open firebird-automations opened 11 years ago

firebird-automations commented 11 years ago

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

abzalov commented 3 years ago

I will bring this up again.

The suggested settings in the OS (/proc/sys/net/ipv4/tcpkeepalive* 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:

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:

2) 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;