Skip to Content.
Sympa Menu

freetds - ct_connect does not timeout when SQL server host is offline

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Nick Brandon" <nbrandon AT hotmail.com>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: ct_connect does not timeout when SQL server host is offline
  • Date: Mon, 11 Mar 2002 08:33:34 -0500


After doing an quantity of investigation I have found the following
problem using FreeTDS 0.53 Ct-Lib Official Release TDS version 7.0 on
Linux.

When the client (in this case PHP/Apache) tries to connect to a server
IP/Name that is offline (no response) the client does not timeout based on
the value set in the freetds.conf file.

i.e. connect timeout = 15
timeout = 30

I have gathered that the network socket is in the SYN_SENT state. In this
state the underlining network stack continues to send packets to the
specified IP until the timeout specified within the kernel (upto 30mins).
The problem is occuring due to the fact that the call to create the
network socket 'connect()' is blocking and hence does not return to the
FreeTDS code until the network stack has returned an error message. This
makes the timeout code around this call within the FreeTDS source code
irrevelant.

Resolution:

I have no experience in programming network sockets but a recommendation
would be to issue a NON-BLOCKING 'connect' call and poll this call until
the value specified in the FreeTDS configuration file. This will allow
FreeTDS to keep control of the network socket at all times.

If someone would like more information, please contact me.

Kind Regards
Nick Brandon




  • ct_connect does not timeout when SQL server host is offline, Nick Brandon, 03/11/2002

Archive powered by MHonArc 2.6.24.

Top of Page