Re: FreeTDS restrictions on query size?

Frediano Ziglio <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <1279646577.11814.3.camel@freddy>
Il giorno mar, 20/07/2010 alle 08.58 -0400, Jason Maur ha scritto:
> > Il giorno lun, 19/07/2010 alle 08.34 -0400, Jason Maur ha scritto:
> > > Hi all,
> > >
> > > I compiled "freetds-0.83.dev.20100706" from source with the following ./configure command:
> > >
> > > ./configure --prefix=/usr/local/freetds --with-tdsver=8.0 --enable-msdblib --enable-dbmfix --with-
> > gnu-ld --with-gnutls --libdir=/usr/local/freetds/lib
> > >
> > > Most queries run successfully, but at least 2 don't. Here are the errors I get when running them
> > with tsql:
> > >
> > > Msg 20004, Level 9, State -1, Server OpenClient, Line -1
> > > Read from the server failed
> > >
> > > and
> > >
> > > Msg 20006, Level 9, State -1, Server OpenClient, Line -1
> > > Write to the server failed
> > > tds_submit_query() failed
> > >
> > 
> > the server probably found an error in the protocol. There should be no
> > limit, tsql issue only language queries (that is simple text).
> > 
> > Please send a tdsdump.
> > 
> > freddy77
> 
> I've attached a tdsdump of the query failing. This gives me a "Write to the server failed" error. I checked it out, and I thought lines 60 - 315 were interesting because they look like they should hold the entire query, but the end is truncated. 
> 
> So, I reduced the size of the query to "fit" in that region of the tdsdump. The result? I then got a "Read from the server failed." Then I tried to simplify the query by taking out all calls to "RIGHT()", "CONVERT()" and "CASE...", and the query worked! 
> 
> To confirm the length problem, I then re-expanded my query--leaving the RIGHT, CONVERT, and CASE calls out--and I received the original write to server error.
> 
> So I'm having 2 issues: 1) if the query is too long, I get the write to server error. 2) if the query is short enough but has some, err, complexities, then I get a read error.
> 
> I also have a separate query that had a read error to begin with. After taking out calls to "RIGHT" and "CONVERT", the query works no problem.
> 
> -Jason

I think the problem is in gnutls (or a strange combination of our code
and specific versions). I tried with my machine and it works correctly
(binary_test send and receive about 130 kb in a row). You can note in
the dump that gnutls send 4357 bytes for a 4096 TDS packet. My version
send 4117 bytes (that is 4096 + 5 for tls header + 16 for padding).

My gnutls version is 2.8.3 (ubuntu 9.04), you could try to update gnutls
or use openssl (see license notes in our user-guide)

freddy77
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.