Skip to Content.
Sympa Menu

freetds - Re: Cancel problem

freetds AT lists.ibiblio.org

Subject: FreeTDS Development Group

List archive

Chronological Thread  
  • From: "Brian Bruns" <camber AT ais.org>
  • To: freetds AT franklin.oit.unc.edu
  • Subject: Re: Cancel problem
  • Date: Wed, 4 Sep 2002 09:30:31 -0400


The current code will handle a TDS_DONE with cancel message anywhere in
the stream. tds_process_cancel will read the stream until it sees it, it
doesn't ditch whole packets, but reads the PDU's. TDS_DONE w/ cancel flag
is guarenteed to be the last PDU of that stream received.

What happens currently, is this: The cancel is sent and the stream is
read until we get a done w/ cancel. Nice and simple. The tds_read_packet
semantics were broken because we couldn't tell the difference between a
error and zero length payload. With the cancelling state we have problems
with streams like:

--packet 1
result set 1
row
row
row
--cancel sent
-- packet 2
row
row
done (no cancel)
result set 2
row
row
--packet 3
row
done (with cancel)

The cancel code needs to understand the stream in order to skip the rows.

So skipping full packets is not an option afaict.

> >
> > Ok, I've checked in a fix. I did some minimal testing since
> > I need to get
> > going to work here in a few, but it seems to hold up.
> >
> > Brian
> >
> Not so good... too much thing are changed... I start to be a little paranoid
> :)
> Just put the while on the first if of tds_get_byte and rollback the
> tds_read_packet...
>
> Also I remember that server can send a packet (with not EOM) between the
> cancel request and the cancel acknowledge.
> I do a SELECT
> server start returning data
> client issue cancel (data are perhaps already in client socket kernel cache)
> server send cancel acknowledge (only-header packet) and done with cancel
> client read for cancel and find the packet of data returned by select. If
> this packet do not finish at packet bounduary tds_process_cancel just join
> this packet to cancel packet... You don't see the done with cancel...
>
> Your fix solve PHP problem (just do a cancel to assert clean state) but not
> this last problem.
>
> I was thinking at this solution:
> - on send cancel
> - reset out packet discarding data
> - set state to cancelling
> - send cancel
> - on read
> - if packet is 0xf with acknowledge and state to cancelling turn state to
> cancelled
> - if state is cancelled discard any packet received
> tds_process_cancel call read so all packet between cancel request and cancel
> acknowledge are discarded. First byte returned should be the DONE token.
>
> freddy77




Archive powered by MHonArc 2.6.24.

Top of Page