[freetds] [PATCH] Bugfix for cancelling a query

Alex Kiesel alex.kiesel at document-root.de
Sun Jan 11 00:55:37 EST 2004


Hi again,

attached is another patch which fixes freetds' behaviour when cancelling
a query. At the moment, when cancelling a query, a cancel packet is
being sent (that is, an empty packet with the headers out_flag set to
0x06 = attention packet). After this, all packets are read until an
acknowledgement of the cancel has been received.

Now, the wire does not contain more data - but as the cancel has been
sent asynchroneously, a client can (and e.g. sqsh often does) call one
of ct_results, ct_fetch and probably more. Thus, this all comes down to
goodread(); freetds tries to read data from the wire where there is no
data available. Due to the timeout handling code - this is being done
over and over again.

My patch changes this to return 0 when the socket is not ready for read
operations. This lets the client leave the result-handling code and
return to "normal" operation. It can start a new query.

After applying this patch, all ctlib- and tds-unittests succeed.
dblib-tests t0013 and t0014 fail; this is a pure timeout problem.
Setting the sockets read timeout to something higher than 1 second fixes
both tests - and all tests pass. I have not enough knowledge to judge
whether this is critical for dblib.

Could someone have a look at this? It would be great if this could be
included into 0.62 if the unittests can be fixed by someone...

Greets,
-Alex
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch-src-tds-read.c.diff
Type: text/x-patch
Size: 652 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20040111/9598b957/patch-src-tds-read.c.bin


More information about the FreeTDS mailing list