Skip to Content.
Sympa Menu

freetds - Bug in ct.c causes hangs on broken connections

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: Chris Underhill <chris AT tart.net>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Bug in ct.c causes hangs on broken connections
  • Date: Thu, 11 May 2000 20:34:33 +0100


Hi,

With the current CVS release of freetds and DBD::Sybase (0.22) I was
having problems when the connection to ms-sql server 7.0 died.
Essentially I have a test program that opens a connection, executes
$dbh->ping and prompts me to press a key after stopping the database.
Once the connection has closed it pings again.

The result being that I get the errors:

TDS: Write failed in tds_write_packet
Error: 32 (Broken pipe)

and then the process hangs.

Setting TDSDUMP I discovered that it was stuck in a loop, with the
following being repeated ad infinitum:

2000-05-11 20:24:14 inside ct_results()
2000-05-11 20:24:14 processing result tokens. marker is 0
2000-05-11 20:24:14 inside tds_process_default_tokens() marker is 0
2000-05-11 20:24:14 leaving tds_process_default_tokens() connection dead

Examining the code, line 340 of src/ctlib/ct.c (1.45)looks to be the
culprit as the routine returns CS_SUCCEED when the call to
tds_process_result_tokens fails returning TDS_FAIL. Changing the value
returned by ct_results to CS_FAIL causes my test script to do the right
thing, after amending the ping routine in DBD::Sybase to check for
$sth->execute being undefined.

Hopefully this is the right fix!


Cheers,


Chris.



  • Bug in ct.c causes hangs on broken connections, Chris Underhill, 05/11/2000

Archive powered by MHonArc 2.6.24.

Top of Page