Skip to Content.
Sympa Menu

freetds - [freetds] Issue with new timeout code

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Ivo van der Wijk" <vladdrac AT gmail.com>
  • To: freetds AT lists.ibiblio.org
  • Subject: [freetds] Issue with new timeout code
  • Date: Tue, 6 Feb 2007 10:12:06 +0000

Hi All

I'm currently using a very recent nightly build (feb 5) of FreeTDS. We
need the recently added timeout code and it works (mostly) as a
charm.

However, in certain cases, when a timeout occurs (which I simply test
by unplugging the utp), FreeTDS (and python, Zope which I use it for
along with it) dies with the following assertion errror:

buffering.h:233: failed assertion `buffer_index_valid(buf, idx)'

Essentially, this happens in dblib.c function dbnextrow(), and I
suspect because of the following.

In this function the following code path is executed:

if (-1 != (idx = buffer_current_index(dbproc))) {
(...)
switch (tds_process_tokens(tds, &res_type, NULL, mask)) {
(...)
default:
result = FAIL;
break;
}
}
if (res_type == TDS_ROW_RESULT || res_type == TDS_COMPUTE_RESULT) {
buffer_transfer_bound_data(&dbproc->row_buf, res_type,
computeid,
dbproc, idx);
}
(...)
return result;

In case of 'default', which sets result to FAIL, the next if is still
evaluated, causing buffer_transfer_bound_data to be invoked, which
triggers the assertion error.

Immediately returning FAIL in the default clause fixes my problem
currently. In other words:

default:
return FAIL;


It would probably be more elegant to test 'result' in the remaining if
statements, and return result at the end of the function.

Can anyone verify that this is a proper bug and proper fix? I'm far
from a FreeTDS expert, and my C is rather rusty. But this does seem to
fix my problem for now.

Kind regards,

Ivo van der Wijk

--
Drs. I.R. van der Wijk / m3r Consultancy B.V.
Linux/Python/Zope/Plone and Open Source solutions
PO-box 51091, 1007 EB Amsterdam, The Netherlands
Email: ivo <at> m3r.nl




Archive powered by MHonArc 2.6.24.

Top of Page