Bug 670346

Summary: Queries >= 505 bytes result in error: Unexpected EOF from the server
Product: [Fedora] Fedora Reporter: Kieron Briggs <kbriggs>
Component: freetdsAssignee: Dmitry Butskoy <dmitry>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: 14CC: dmitry
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: freetds-0.82.1-0.3.20110306dev.fc14 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-03-19 05:47:51 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Test program demonstrating the error
none
Proposed patch against freetds-0.82 none

Description Kieron Briggs 2011-01-17 23:28:27 UTC
Created attachment 473945 [details]
Test program demonstrating the error

Description of problem:

Executing a parameterless ODBC prepared statement which is >= 505 bytes long against SQL Server results in a protocol error that causes SQL Server to drop the connection, which causes freetds to report "Unexpected EOF from the server".


Version-Release number of selected component (if applicable):

freetds-0.82 as packaged with Fedora 11+


How reproducible:

Always


Steps to Reproduce:
1. SQL[Driver]Connect() to a SQL Server database
2. SQLPrepare() a query >= 505 bytes long
3. SQLExecute()

See attached test program.

  
Actual results:

Error: [FreeTDS][SQL Server]Unexpected EOF from the server


Expected results:

Query executes successfully


Additional info:

This seems to be the result of the freetds 0.82 package shipped with all current Fedora releases not including a change that was checked into the upstream repository over two years ago: See http://freetds.cvs.sourceforge.net/viewvc/freetds/freetds/src/tds/query.c?view=log&pathrev=BRANCH0_82;
the current packages appear to contain revision 1.217.2.1; the change in question is revision 1.217.2.3 "fix tds_send_emulated_execute if no parameters".

Applying this simple, one-line change allows long queries to be executed successfully.

Comment 1 Kieron Briggs 2011-01-17 23:32:36 UTC
Created attachment 473946 [details]
Proposed patch against freetds-0.82

Proposed patch (taken from http://freetds.cvs.sourceforge.net/viewvc/freetds/freetds/src/tds/query.c?r1=1.217.2.2&r2=1.217.2.3&pathrev=BRANCH0_82)

Comment 2 Kieron Briggs 2011-01-19 04:50:57 UTC
It seems that the error can be avoided if the TDS_Version parameter is included in the connection string and set to either 7.0 or 8.0 (assuming, of course, that the server supports these versions). This is because a slightly different path is taken through the statement execution code which avoids the problematic line.

Comment 3 Fedora Update System 2011-02-10 18:53:19 UTC
freetds-0.82.1-0.1.20100810dev.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/freetds-0.82.1-0.1.20100810dev.fc14

Comment 4 Fedora Update System 2011-02-10 18:54:01 UTC
freetds-0.82.1-0.1.20100810dev.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/freetds-0.82.1-0.1.20100810dev.fc13

Comment 5 Fedora Update System 2011-02-13 08:50:28 UTC
freetds-0.82.1-0.1.20100810dev.fc14 has been pushed to the Fedora 14 testing repository.  If problems still persist, please make note of it in this bug report.
 If you want to test the update, you can install it with 
 su -c 'yum --enablerepo=updates-testing update freetds'.  You can provide feedback for this update here: https://admin.fedoraproject.org/updates/freetds-0.82.1-0.1.20100810dev.fc14

Comment 6 Fedora Update System 2011-02-14 16:12:04 UTC
freetds-0.82.1-0.2.20100810dev.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/freetds-0.82.1-0.2.20100810dev.fc15

Comment 7 Fedora Update System 2011-02-14 16:13:52 UTC
freetds-0.82.1-0.2.20100810dev.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/freetds-0.82.1-0.2.20100810dev.fc14

Comment 8 Fedora Update System 2011-02-14 16:15:00 UTC
freetds-0.82.1-0.2.20100810dev.fc13 has been submitted as an update for Fedora 13.
https://admin.fedoraproject.org/updates/freetds-0.82.1-0.2.20100810dev.fc13

Comment 9 Fedora Update System 2011-03-09 19:00:48 UTC
freetds-0.82.1-0.3.20110306dev.fc15 has been submitted as an update for Fedora 15.
https://admin.fedoraproject.org/updates/freetds-0.82.1-0.3.20110306dev.fc15

Comment 10 Fedora Update System 2011-03-09 19:01:41 UTC
freetds-0.82.1-0.3.20110306dev.fc14 has been submitted as an update for Fedora 14.
https://admin.fedoraproject.org/updates/freetds-0.82.1-0.3.20110306dev.fc14

Comment 11 Fedora Update System 2011-03-19 05:47:47 UTC
freetds-0.82.1-0.3.20110306dev.fc15 has been pushed to the Fedora 15 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 12 Fedora Update System 2011-03-19 10:29:39 UTC
freetds-0.82.1-0.3.20110306dev.fc14 has been pushed to the Fedora 14 stable repository.  If problems still persist, please make note of it in this bug report.