Skip to Content.
Sympa Menu

freetds - [freetds] Connection Hangs

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Duncan Berriman" <duncan AT dcl.co.uk>
  • To: <freetds AT lists.ibiblio.org>
  • Subject: [freetds] Connection Hangs
  • Date: Fri, 16 Mar 2007 10:14:52 -0000

Hi,

New to the list so apologies if I'm not doing anything correctly.

Been using freetds for 6 months or so with no problems.

I have a process that runs on a number of servers running various versions
of Fedora and periodically connects to a MSSQL database, does some work and
then disconnects.

This morning I noticed that for about an hour every time the process was
started and it attempted to connect it hung on the connect. A whole queue of
these processes formed on each server all in the hung state which is odd
given that there is a connection and login timeout set.

Eventually (after about an hour) all the processes responded with "Unable to
open data source".

I was still working on the problem trying to see what was happening when
this happened so now that the problem has resolved itself it will probably
be pretty impossible to reproduce.

Given that separate servers all had the same problem and its run fine for
months I'm pretty sure its not the servers/software/my code etc but more a
bug/feature in freetds where the connection/login attempt does not timeout.

Has anyone else seen behaviour like this, have any suggestions how I may
trouble shoot it if it happens again?

Code snippet

if (SQLAllocEnv(&Environment) == SQL_SUCCESS) {
if (SQLAllocConnect(Environment, &Connection) == SQL_SUCCESS) {
res = SQLSetConnectAttr(Connection,
SQL_ATTR_CONNECTION_TIMEOUT, (SQLPOINTER) connect_timeout, SQL_IS_UINTEGER);
if (res == SQL_SUCCESS) {
res = SQLSetConnectAttr(Connection,
SQL_ATTR_LOGIN_TIMEOUT, (SQLPOINTER) connect_timeout, SQL_IS_UINTEGER);
if (res == SQL_SUCCESS) {
sprintf(message,
"DRIVER=/usr/lib/libtdsodbc.so;SERVER=%s;PORT=%d;UID=%s;PWD=%s;DATABASE=%s;T
DS_VERSION=8.0;APP=xxx;WSID=xxx;",host_address,dbport,user,pass,dbname);
res = SQLDriverConnect(Connection, NULL,
(SQLCHAR *) message, SQL_NTS, (SQLCHAR *) message, sizeof(message), &len,
SQL_DRIVER_NOPROMPT);

Thanks in advance
Duncan






Archive powered by MHonArc 2.6.24.

Top of Page