Home  |  Linux  | Mysql  | PHP  | XML
From:fr.deboffles@gmail.com Date:Mon Jul 21 21:01:12 2008
Subject:ExecuteReader hangs and goes 100%CPU when the network cable is
unplugged
Hi,
I am making a query using a stored procedure to our Sybase server. The
query I am using can take up to an hour to process before returning
the reader (I have no means to change the server behaviors). If I
unplugged the network cable on my computer while I am in a
ExecuteReader statement the processor goes 100%CPU and the program
hangs. It will only stop when the CommandTimeout occurs (meaning in
the worst case one hour after the event).
I was expecting receiving an exception for the drop of connection.
Can anyone help me ?

I am using Sybase ADO.Net 1.15.50.0 on Windows XP sp2 with
VisualStudio 2005 and .Net 3.5

Here is the code I use to do that:
    IDbConnection db_conn = new AseConnection();
    db_conn.ConnectionString = "DataSource='172.26.32.15';" +
        "Port='5000';" +
        "UID='user';" +
        "PWD='pass';" +
        "ApplicationName='" +
System.Windows.Forms.Application.ProductName + "';" +
        "ClientHostName='" + System.Environment.UserName + "';" +
        "ClientHostProc='" + System.Environment.UserName + "-" +
        System.Windows.Forms.Application.ProductName + "';" +
        "EnableServerPacketSize=1;";
    try
    {
        // Open the connection
        db_conn.Open();
    }
    catch (AseException ex)
    {
        // Handle AseException
    }

    IDbCommand db_cmd = db_conn.CreateCommand();
    db_cmd.CommandText = "my_sp";
    IDbDataParameter param = dbCmd.CreateParameter();
    param.ParameterName = "@customerid";
    param.DbType = DbType.Int32;
    param.Value = Convert.ToInt32(1);
    db_cmd.Parameters.Add(param);

    db_cmd.CommandTimeout = 3600; //1 hour
    IDataReader rdr = null;
    if (db_conn.State == ConnectionState.Open)
    {
        try
        {
            // If I unplug the network cable while executing this line
the CPU goes 100% until the timeout trigger
            rdr =
db_cmd.ExecuteReader(CommandBehavior.SequentialAccess);
        }
        catch (AseException ex)
        {
	        // Handle AseException
        }
    }
    ...
    ...

Thanks,
Navigate in group sybase.public.connectivity.adonet at sever forums.sybase.com
Previous Next


Your recent visits
PHP --info giving segmentation fault
Re: [PHP] Dom PDF Problem
Re: Storing a file from a cgi parameter
problem with PEAR , windows platform , php 5.2.9-2 , IIS Version 6
Re: [PHP-DB] mysqli error


  
© No Copyright
You are free to use Anything
Site Maintained by Zareef Ahmed
Powered By PHP Consultants