[freetds] long query fails with [unixODBC][FreeTDS][SQL Server]Read from the server failed

ZIGLIO, Frediano, VF-IT Frediano.Ziglio at vodafone.com
Wed Aug 6 03:06:13 EDT 2008


> When I issue the query (see below) via ODBC, I get the 
> following error:
> 
>   [unixODBC][FreeTDS][SQL Server] Read from the server failed
> 
> If I shorten the query by removing several lines of SQL comments, the
> query succeeds.
> 
> Interestingly, I can successfully run the query from sqsh.
> 
> I am using the latest build from CVS, 0.83.dev.20080801 but the
> problem is also reproducible with 0.82.
> 
> Other info:
> * server is SQL Server 2005
> * client OS is Debian testing AMD64
> * unixODBC version is 2.2.11
> * ODBC-combined configuration
> 
> The freetds log follows after the query.
> 
> TIA
> 
> >>>>>>>>>>>>>>>>>>>>>>>> BEGIN QUERY >>>>>>>>>>>>>>>>>>>>>>>>
> select 1
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXX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XXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> -- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
> >>>>>>>>>>>>>>>>>>>>>>>> END QUERY >>>>>>>>>>>>>>>>>>>>>>>>
> 
> 
> Here is the freetds.log:
> 
> log.c:190:Starting log file for FreeTDS 0.83.dev.20080801
> on 2008-08-01 13:55:47 with debug flags 0x4fff.
> iconv.c:197:names for ISO-8859-1: ISO-8859-1
> iconv.c:197:names for UTF-8: UTF-8
> iconv.c:197:names for UCS-2LE: UCS-2LE
> iconv.c:197:names for UCS-2BE: UCS-2BE
> iconv.c:363:iconv to convert client-side data to the 
> "ISO-8859-1" character set
> iconv.c:516:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
> iconv.c:516:tds_iconv_info_init: converting "ISO-8859-1"->"UCS-2LE"
> net.c:204:Connecting to 10.45.194.10 port 1433 (TDS version 8.0)
> net.c:258:tds_open_socket: connect(2) returned "Operation now 
> in progress"
> net.c:296:tds_open_socket() succeeded
> util.c:162:Changed query state from DEAD to IDLE
> login.c:734:quietly sending TDS 7+ login packet
> token.c:312:tds_process_login_tokens()
> net.c:662:Received packet
> 0000 04 01 01 85 00 62 01 00-e3 1b 00 01 06 6d 00 61 
> |.....b.. .....m.a|
> 0010 00 73 00 74 00 65 00 72-00 06 6d 00 61 00 73 00 
> |.s.t.e.r ..m.a.s.|
> 0020 74 00 65 00 72 00 ab 6c-00 45 16 00 00 02 00 25 
> |t.e.r..l .E.....%|
> 0030 00 43 00 68 00 61 00 6e-00 67 00 65 00 64 00 20 
> |.C.h.a.n .g.e.d. |
> 0040 00 64 00 61 00 74 00 61-00 62 00 61 00 73 00 65 
> |.d.a.t.a .b.a.s.e|
> 0050 00 20 00 63 00 6f 00 6e-00 74 00 65 00 78 00 74 |. 
> .c.o.n .t.e.x.t|
> 0060 00 20 00 74 00 6f 00 20-00 27 00 6d 00 61 00 73 |. .t.o. 
>  .'.m.a.s|
> 0070 00 74 00 65 00 72 00 27-00 2e 00 0b 41 00 53 00 
> |.t.e.r.' ....A.S.|
> 0080 43 00 2d 00 53 00 51 00-4c 00 30 00 45 00 4e 00 
> |C.-.S.Q. L.0.E.N.|
> 0090 31 00 00 01 00 e3 08 00-07 05 09 04 d0 00 34 00 
> |1....... ......4.|
> 00a0 e3 17 00 02 0a 75 00 73-00 5f 00 65 00 6e 00 67 
> |.....u.s ._.e.n.g|
> 00b0 00 6c 00 69 00 73 00 68-00 00 ab 70 00 47 16 00 
> |.l.i.s.h ...p.G..|
> 00c0 00 01 00 27 00 43 00 68-00 61 00 6e 00 67 00 65 
> |...'.C.h .a.n.g.e|
> 00d0 00 64 00 20 00 6c 00 61-00 6e 00 67 00 75 00 61 |.d. 
> .l.a .n.g.u.a|
> 00e0 00 67 00 65 00 20 00 73-00 65 00 74 00 74 00 69 |.g.e. 
> .s .e.t.t.i|
> 00f0 00 6e 00 67 00 20 00 74-00 6f 00 20 00 75 00 73 |.n.g. 
> .t .o. .u.s|
> 0100 00 5f 00 65 00 6e 00 67-00 6c 00 69 00 73 00 68 
> |._.e.n.g .l.i.s.h|
> 0110 00 2e 00 0b 41 00 53 00-43 00 2d 00 53 00 51 00 
> |....A.S. C.-.S.Q.|
> 0120 4c 00 30 00 45 00 4e 00-31 00 00 01 00 ad 36 00 
> |L.0.E.N. 1.....6.|
> 0130 01 71 00 00 01 16 4d 00-69 00 63 00 72 00 6f 00 
> |.q....M. i.c.r.o.|
> 0140 73 00 6f 00 66 00 74 00-20 00 53 00 51 00 4c 00 
> |s.o.f.t.  .S.Q.L.|
> 0150 20 00 53 00 65 00 72 00-76 00 65 00 72 00 00 00 | 
> .S.e.r. v.e.r...|
> 0160 00 00 09 00 0b ee e3 13-00 04 04 38 00 30 00 30 
> |........ ...8.0.0|
> 0170 00 30 00 04 34 00 30 00-39 00 36 00 fd 00 00 00 
> |.0..4.0. 9.6.....|
> 0180 00 00 00 00 00         -                        |.....|
> 
... omissis ...

Here server is replying that packet size is 8000 while you specify a packet size of 8192.
Probably server limited packet size to 8000. This is a setting of sql server.
I tried to reproduce by myself. I set "initial block size" to 60000 and server limited it
to 32764. I send a very long query (more than 32000 characters) and got same problem. It
seems that client should not obey to server limit cause server close connection as it gets
more bytes. It's strange however that your server is set to 8000... I don't understand
why...

freddy77
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3129 bytes
Desc: not available
Url : http://lists.ibiblio.org/pipermail/freetds/attachments/20080806/90412ead/attachment.bin 


More information about the FreeTDS mailing list