[Mono-bugs] [Bug 350906] New: Sybase ExecuteReader hangs on killed sessions

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Fri Dec 28 10:38:43 EST 2007


           Summary: Sybase ExecuteReader hangs on killed sessions
           Product: Mono: Runtime
           Version: 1.2.6
          Platform: i386
        OS/Version: Red Hat 9.0
            Status: NEW
          Severity: Critical
          Priority: P5 - None
         Component: misc
        AssignedTo: mono-bugs at ximian.com
        ReportedBy: jdanon at optonline.net
         QAContact: mono-bugs at ximian.com
          Found By: ---

Description of Problem:

When executing SQL on a SybaseConnection that has been killed remotely, the
ExecuteReader method does not return. It blocks the thread on which it was
called indefinitely.

Steps to reproduce the problem:

using System.Data;
using Mono.Data.SybaseClient;
using System.Threading; 

 public class Test
    public static void Main(string[] args)
       string connectionString =
          "Server=server,5000; Database=dbname; User ID=username;

       IDbConnection dbcon = new SybaseConnection(connectionString);

       Console.WriteLine( "Connection status: {0}", dbcon.State );
       // During this next 15 second sleep, log in to Sybase server and
       // kill the connection via kill <spid> command.
       Console.WriteLine( "Connection status: {0}", dbcon.State );

       IDbCommand dbcmd = dbcon.CreateCommand();
       dbcmd.CommandText = "SELECT name FROM master..sysobjects";
       IDataReader reader = dbcmd.ExecuteReader(); // <-- program hangs here

       while(reader.Read()) {
            string objName = reader["name"].ToString();
            Console.WriteLine("Name: " + objName);

       reader = null;
       dbcmd = null;
       dbcon = null;

Actual Results:

Console output...

Connection status: Open
Connection status: Open
[then the ExecuteReader hangs]

Expected Results:

Connection status: Open
Connection status: Closed
InvalidOperationException thrown.

How often does this happen? 
All the time if database is disconnected remotely. Easy to reproduce.

Additional Information:
Doing something similar as the above in Visual Studio via ODBC yields an "Open"
state even after the connection is closed (like mono), but at least the
InvalidOperationException gets thrown as soon as SQL execution is attempted on
a closed connection. It appears that under Windows the connection doesn't
necessarily know that it's closed either, but finds out on the next executed
statement because after the exception is thrown, checking the State member
reveals that it's closed. Sybase version tested was 12.5.1.

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

More information about the mono-bugs mailing list