Skip to Content.
Sympa Menu

freetds - Re: [freetds] FreeTDS issue with SQL_ATTR_QUERY_TIMEOUT

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Bhagya Prasad" <bhprasad AT gmail.com>
  • To: "FreeTDS Development Group" <freetds AT lists.ibiblio.org>
  • Subject: Re: [freetds] FreeTDS issue with SQL_ATTR_QUERY_TIMEOUT
  • Date: Thu, 30 Oct 2008 16:20:32 +0530

Hi
Thanks for this information. This how we can reproduce the problem..

1. Establish connection to MSSQL server via FreeTDS and make couple of SQL
queries which succeed.
2. Now disconnect the MSSQL server from network and make an SQL query by
setting the query timeout of 10 seconds
3. Note that application receives the response after 20 seconds (instead of
10 seconds)

Pasted snippet of FreeTDS traces below. First the SQL query is timing out
as the MSSQL server is out of network and next cancellation is happening
with the same timeout. Hence it is taking twice the amount of time to
return to app than what is specified by the client in
SQL_ATTR_QUERY_TIMEOUT.

Is there a way we can bypass cancellation ? Is this required as the server
already out of network and even this would fail anyways? OR can FreeTDS
take half the timeout specified in SQL_ATTR_QUERY_TIMEOUT to query and do
the cancellation. [This way the timeout specified by the client will be in
sync when the library returns from the call]

------------

util.c:162:Changed query state from IDLE to QUERYING
util.c:162:Changed query state from QUERYING to PENDING
net.c:779:Sending packet
<SQL query ....>

token.c:495:tds_process_tokens(0x2aaab8511510, 0x43200414, 0x43200410,
0x6914)
util.c:162:Changed query state from PENDING to READING
util.c:334:tdserror(0x2aaab84ebd80, 0x2aaab8511510, 20003, 0)
odbc.c:2032:msgno 20003 20003
odbc.c:2035:in timeout
odbc.c:2061:returning from timeout
util.c:368:tdserror: client library returned TDS_INT_TIMEOUT(3)
query.c:1934:tds_send_cancel: not in_cancel and not idle
query.c:1943:tds_send_cancel: sending cancel packet
net.c:779:Sending packet
0000 06 01 00 08 00 00 00 00- |........|

util.c:389:tdserror: returning TDS_INT_CONTINUE(1)
util.c:334:tdserror(0x2aaab84ebd80, 0x2aaab8511510, 20003, 0)
odbc.c:2032:msgno 20003 20003
odbc.c:2035:in timeout
util.c:162:Changed query state from READING to DEAD
odbc.c:2058:returning cancel from timeout
util.c:368:tdserror: client library returned TDS_INT_CANCEL(2)
util.c:389:tdserror: returning TDS_INT_CANCEL(2)


Thanks,
Bhagya

On Thu, Oct 30, 2008 at 2:03 PM, Frediano Ziglio <freddy77 AT gmail.com> wrote:

> >
> > Hi,
> > We are using FreeTDS version 0.82 to connect to MSSQL Server
> > 2005. One
> > issue I observed was that, whenever we set
> > SQL_ATTR_QUERY_TIMEOUT it takes
> > twice the amount of time to return than the specified value
> > if the server is
> > not available.
> >
> > For example, if I set the query timeout to 10 seconds, it
> > returns after 20
> > seconds.
> >
> > Is this an issue or behavior? Is there a spec on the
> > implementation of
> > timeouts in FreeTDS which I can refer to ?
> >
> >
> > Thanks,
> > Bhagya
>
> This is due to cancellation, on first timeout we send cancellation on
> second
> we timeout. In this case however you should not have a cancellation....
> Note
> however that usually during connection there are two timeouts, one relative
> to connection (think about network connection) and another for settings
> (that login timeout). You should enable logging to see which problem you
> have during connection.
>
> freddy77
> _______________________________________________
> FreeTDS mailing list
> FreeTDS AT lists.ibiblio.org
> http://lists.ibiblio.org/mailman/listinfo/freetds
>




Archive powered by MHonArc 2.6.24.

Top of Page