[Mono-bugs] [Bug 381151] New: DataAdapter returns 0 rows after an SQL timeout occured

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Apr 18 01:03:45 EDT 2008


https://bugzilla.novell.com/show_bug.cgi?id=381151


           Summary: DataAdapter returns 0 rows after an SQL timeout occured
           Product: Mono: Class Libraries
           Version: 1.9.0
          Platform: i586
        OS/Version: Other
            Status: NEW
          Severity: Major
          Priority: P5 - None
         Component: Sys.Data
        AssignedTo: bnc-blr-team-mono at forge.provo.novell.com
        ReportedBy: mark at dawebber.com
         QAContact: mono-bugs at lists.ximian.com
          Found By: Customer


Created an attachment (id=208820)
 --> (https://bugzilla.novell.com/attachment.cgi?id=208820)
Code fragment to illustrate the issue

Issue: In 2.0 Mono profile, after an SQL timeout has been experienced,
DataAdapter will return no rows from any SELECT statement, even if it doesn't
encounter another timeout. In addition, CommandTimeout property is being
ignored.

I briefly discussed this with Veerapuram and he suggested that a bug report be
filed.


Here are  the details:

1) the problem only exists under Mono when the program is compiled using 2.0
profile (or greater, haven't tested). We are developing our software in 2.0
2) under 1.1 profile, the problem doesn't seem reproducible.
3) the problem only exists when the same connection had experienced an SQL
timeout previosuly.


Here are the steps to reproduce the problem. I used Mono 1.2.3 for 1.1 profile
(default in that version) and Mono 1.9 for 2.0 profile (default in that
version). 


1) Simulate the SQL timeout.
        a) create a table in tempdb called junk. The table definition is not
important, but an example is below:
                CREATE TABLE Junk (
                        field1 varchar (50) NULL ,
                        field2 char (10) NULL ,
                        field3 char (10) NULL 
                )
        b) run a series of insert statements to put some data there.
        c) prepare the following query:
                BEGIN TRANSACTION
                        UPDATE Junk WITH (TABLOCKX)
                                SET field1=field1

        This is a very crude simulation of a complete table lock, excluding any
read/write access to it. Run the query.

2) Compile a C# program DAFail.cs for both 1.1 and 2.0 profiles with the
following command line:

                mcs DAFail.cs /out:DAFail.exe /r:System.Data.dll
3) Run the test
        a) run the program under mono 1.1:

observe the following output (I ran it with the debug flag:

mono --debug DAFail.exe
Test from linux
Open
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed
prior to completion of the operation or the server is not responding. --->
Mono.Data.Tds.Protocol.TdsTimeoutException: Timeout expired. The timeout period
elapsed prior to completion of the operation or the server is not responding.
  at Mono.Data.Tds.Protocol.Tds.CheckForData (Int32 timeout) [0x00030] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:572
  at Mono.Data.Tds.Protocol.Tds.ExecuteQuery (System.String sql, Int32 timeout,
Boolean wantResults) [0x00029] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:433
  at Mono.Data.Tds.Protocol.Tds70.Execute (System.String commandText,
Mono.Data.Tds.TdsMetaParameterCollection parameters, Int32 timeout, Boolean
wantResults) [0x00035] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs:418
  at System.Data.SqlClient.SqlCommand.Execute (CommandBehavior behavior,
Boolean wantResults) [0x00170] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:379
  at System.Data.SqlClient.SqlCommand.ExecuteReader (CommandBehavior behavior)
[0x00027] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:421
--- End of inner exception stack trace ---

  at System.Data.SqlClient.SqlCommand.ExecuteReader (CommandBehavior behavior)
[0x0005a] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:429
  at System.Data.SqlClient.SqlCommand.ExecuteReader () [0x00000] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:411
  at (wrapper remoting-invoke-with-check)
System.Data.SqlClient.SqlCommand:ExecuteReader ()
  at MainClass.Main (System.String[] args) [0x00000]
---------------------------------------------------
Hit Enter for me, will ya?

Performing DA test


Unhandled Exception: System.Data.SqlClient.SqlException: Timeout expired. The
timeout period elapsed prior to completion of the operation or the server is
not responding. ---> Mono.Data.Tds.Protocol.TdsTimeoutException: Timeout
expired. The timeout period elapsed prior to completion of the operation or the
server is not responding.
  at Mono.Data.Tds.Protocol.Tds.CheckForData (Int32 timeout) [0x00030] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:572
  at Mono.Data.Tds.Protocol.Tds.ExecuteQuery (System.String sql, Int32 timeout,
Boolean wantResults) [0x00029] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:433
  at Mono.Data.Tds.Protocol.Tds70.Execute (System.String commandText,
Mono.Data.Tds.TdsMetaParameterCollection parameters, Int32 timeout, Boolean
wantResults) [0x00035] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs:418
  at System.Data.SqlClient.SqlCommand.Execute (CommandBehavior behavior,
Boolean wantResults) [0x00170] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:379
  at System.Data.SqlClient.SqlCommand.ExecuteReader (CommandBehavior behavior)
[0x00027] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:421
--- End of inner exception stack trace ---

  at System.Data.SqlClient.SqlCommand.ExecuteReader (CommandBehavior behavior)
[0x0005a] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:429
  at System.Data.SqlClient.SqlCommand.System.Data.IDbCommand.ExecuteReader
(CommandBehavior behavior) [0x00000] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:518
  at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet, Int32
startRecord, Int32 maxRecords, System.String srcTable, IDbCommand command,
CommandBehavior behavior) [0x0004f] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs:322
  at System.Data.Common.DbDataAdapter.Fill (System.Data.DataSet dataSet)
[0x00000] in
/home/mandrake/rpm/BUILD/mono-1.2.3.1/mcs/class/System.Data/System.Data.Common/DbDataAdapter.cs:246
  at MainClass.Main (System.String[] args) [0x00000]

This is the correct behavior--after 5 seconds each, both the DataReader and
DataAdapter.Fill timed out and threw the appropriate exception.


        b) Then, run it under 2.0 (Note, that DataAdapter will never return by 
                        itself, as it doesn't seem to honor the CommandTimeout
property). So, after a bit, issue ROLLBACK statement in the query window to
release the table. 

Here's the output you get:
mono --debug DAFail.exe
Test from linux
Open
System.Data.SqlClient.SqlException: Timeout expired. The timeout period elapsed
prior to completion of the operation or the server is not responding. --->
Mono.Data.Tds.Protocol.TdsTimeoutException: Timeout expired. The timeout period
elapsed prior to completion of the operation or the server is not responding.
  at Mono.Data.Tds.Protocol.Tds.CheckForData (Int32 timeout) [0x00030] in
/usr/src/rpm/BUILD/mono-1.9/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:633
  at Mono.Data.Tds.Protocol.Tds.ExecuteQuery (System.String sql, Int32 timeout,
Boolean wantResults) [0x00029] in
/usr/src/rpm/BUILD/mono-1.9/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds.cs:483
  at Mono.Data.Tds.Protocol.Tds70.Execute (System.String commandText,
Mono.Data.Tds.TdsMetaParameterCollection parameters, Int32 timeout, Boolean
wantResults) [0x00034] in
/usr/src/rpm/BUILD/mono-1.9/mcs/class/Mono.Data.Tds/Mono.Data.Tds.Protocol/Tds70.cs:516
  at System.Data.SqlClient.SqlCommand.Execute (CommandBehavior behavior,
Boolean wantResults) [0x001ea] in
/usr/src/rpm/BUILD/mono-1.9/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:434
--- End of inner exception stack trace ---

  at System.Data.SqlClient.SqlCommand.Execute (CommandBehavior behavior,
Boolean wantResults) [0x00216] in
/usr/src/rpm/BUILD/mono-1.9/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:437
  at System.Data.SqlClient.SqlCommand.ExecuteReader (CommandBehavior behavior)
[0x00027] in
/usr/src/rpm/BUILD/mono-1.9/mcs/class/System.Data/System.Data.SqlClient/SqlCommand.cs:486




---------------------------------------------------
Hit Enter for me, will ya?
Performing DA test
Filled with data
Tables in DA: 1
Rows in the first table: 0


So, the second case returns 0 rows, which is incorrect. 

        c) now, run the code with no table lock under both profiles:

The output will be something like this (I inserted two rows, one with the value
"TEST" and the other with the value "TEST1"):

mono --debug DAFail.exe
Test from linux
Open
Records Affected: -1

 TEST
 TEST1
---------------------------------------------------
Hit Enter for me, will ya?

Performing DA test
Filled with data
Tables in DA: 1
Rows in the first table: 2

First Col:  TEST
First Col:  TEST1


So, it looks like two things are not working for me under 2.0 profile in
ADO.NET:

1) DataAdapter doesn't seem to honor CommandTimeout
2) Most Importantly: it returns 0 rows , when an SqlException should be in
order or a correct row collection (not an empty one).

The program itself is pretty dumb, but it serves to illustrate the issue.

Please let me know if anything else is needed to get these issues fixed.


-- 
Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.


More information about the mono-bugs mailing list