[PATCH] Solaris/Intel client, Sybase server: Unknown marker: 105!!

Craig Jackson CRAIGJ at EPUB.IACNET.COM
Wed Aug 22 16:52:27 EDT 2001


On Wed, 22 Aug 2001, Steve Willer wrote:
>On Tue, 21 Aug 2001, Steve Willer wrote:

>> If I run a "select * from sometable" query, and then fetch the rows one by
>> one, at around 200 or 300 retrieved rows, the client starts to freak out.
>>
>> Here's a relevant excerpt:
>>
>> READING ROW 411:
>> READING ROW 412:
>> Out of memory during ridiculously large request at
>> modules/VR/Kernel/Database.pm line 1282.
>> Unknown marker: 44!!
>> Unknown marker: 114!!

>Okay. It cost me a day, but I've figured it out. This is what happens:

>a) when reading the packet headers for a large-ish query result, at some
>   point down the line eventually the 8-byte packet header is divided up
>   over two tcp packets (at least when I run it here, with our config)
>b) goodread(), in src/tds/read.c, assumes that read() returns all of the
>   data it asked for, and in this particular case gets 4 bytes instead of
>   8
>c) tds_process_row(), two functions down the call stack, assumes that it
>   got all 8 header bytes, and therefore gets an invalid packet length
>d) numbers are now bad, malloc is given bad sizes for allocation, and
>   somehow Perl 5.6.1 has overridden malloc
>e) Perl (rudely) lops a bunch of functions off the top of the stack,
>   throwing FreeTDS into an out-of-phase situation it can never recover
>   from
>f) stick a fork in it, it's done

>The good news is it's a one-line fix.

>The bad line, around line 95 in src/tds/read.c, in the goodread()
>function says this:

>  got = READ(tds->s, buf, buflen);

>it should say this:

>  while (got < buflen) {
>    got += READ(tds->s, buf + got, buflen - got);
>  }

This look like it could go into an infinite loop if READ returned 0 (EOF).
Is this checked for in the definition of READ?

Craig


>If someone could fix this in the CVS copy, I would appreciate it.


>---
>You are currently subscribed to freetds as: [craigj at epub.iacnet.com]
>To unsubscribe, forward this message to $subst('Email.Unsub')

Craig Jackson
Craig_Jackson at iacnet.com
The Gale Group
Burlington, MA, USA



More information about the FreeTDS mailing list