SSL - Transport channel is closed when using DataReader

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for MySQL
Post Reply
tduong
Posts: 4
Joined: Fri 08 Oct 2010 00:43

SSL - Transport channel is closed when using DataReader

Post by tduong » Tue 15 Feb 2011 01:12

Hi,

I am running into a "transport channel is closed" exception while executing a DataReader against a large table, but this only happens when the database is configured with SSL. I am using version 6.0.58.0.

Here is some code that can reproduce our problem:

Code: Select all


string connString = 

using (IDbConnection conn = new MySqlConnection(connString))
{
    IDbCommand cmd = conn.CreateCommand();
    cmd.CommandText = "SELECT * FROM large_table;";
    cmd.CommandTimeout = 0;

    IDataReader reader = dbCommand.ExecuteReader();

    while (reader.Read()) 
    {
        // Sleep for 5 milliseconds to emulate some data processing
        // The exception can be observed even with 1 millisecond sleep.
        // [size=x-large]If no ThreadSleep is issued, then the code runs just fine[/size]
        Thread.Sleep(5); 
    }
}

When I run the above snippet against a large table (5Gb, ~500000 rows with text and blob columns) on an SSL enabled database, I receive a "Lost connection to MySQL server during query" exception. The inner exception is, "Transport Channel is closed".

Exception: Lost connection to MySQL server during query

Inner Exception: Devart.Common.i: Transport channel is closed.
at Devart.Common.s.e(Byte[] A_0, Int32 A_1, Int32 A_2)
Stack: at Devart.Data.MySql.bh.a(Exception A_0)
at Devart.Common.s.e(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.MySql.bk.a(Byte[] A_0, Int32 A_1, Int32 A_2)
at Devart.Data.MySql.bk.a()
at Devart.Data.MySql.bk.b(Byte[] A_0)
at Devart.Data.MySql.v.a(Byte[] A_0)
at Devart.Data.MySql.v.a(Byte[] A_0, Boolean A_1)
at Devart.Data.MySql.ao.f()
at Devart.Data.MySql.a2.b(Boolean A_0)
at Devart.Data.MySql.MySqlDataReader.a(Boolean A_0)
at Devart.Common.l.a(Int32 A_0, Object A_1, Int32 A_2, Object A_3)
at Devart.Common.l.a.a(Int32 A_0, Int32 A_1, Object A_2, l A_3)
at Devart.Common.l.a(Int32 A_0, Int32 A_1, Object A_2)
at Devart.Common.DbConnectionBase.a(Int32 A_0)
at Devart.Common.DbConnectionBase.Close()
at Devart.Common.DbConnectionBase.Dispose(Boolean disposing)
at System.ComponentModel.Component.Dispose()
The following are some MySql Server and connection specific values that I've played around with. None of them seem to have a direct correlation with the exception that I'm seeing:

Wait_Timeout - This value is by default already 8 hours, the reader is throwing the exception within 4-5 minutes.

Connect_Timeout - This value has been increased to some rather large value even though I do not really suspect this to be the culprit. The value is modified by issuing a "SET Connect_Timeout" command using the same connection object

Net_Read_Timeout
Net_Write_Timeout - Both these values have been increased to 10 minutes with the "SET NET_WRITE_TIMEOUT/NET_READ_TIMEOUT" command using the same connection object that is used to issue the query.

I would also like to mention that if we do not connect to the database with SSL, the above code runs just fine.

When I run the above code, I could see the mysql server executing the "select" command by running a "SHOW FULL PROCESSLIST" from another mysql client application. The status is usually "Sending data" or "Writing to Net". I'm no expert on the inner workings of the DataReader, but logically the data sent from the server must reside somewhere on the client. Is there some threshold that's being hit, causing Devart to close the channel and throw this exception due to the data being so massive?

Thank you for your help!

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 17 Feb 2011 11:35

We have reproduced the problem. We will post here about the results of our investigation.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 18 Feb 2011 16:27

We have fixed the bug with System.OutOfMemoryException when retrieving BLOB values in SSL mode. I will post here when the corresponding build is available for download.

tduong
Posts: 4
Joined: Fri 08 Oct 2010 00:43

Post by tduong » Fri 18 Feb 2011 17:53

That's great news! Looking forward to the next build!

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Thu 24 Feb 2011 15:21

New build of dotConnect for MySQL 6.10.111 is available for download now!
It can be downloaded from http://www.devart.com/dotconnect/mysql/download.html (trial version) or from Registered Users' Area (for users with valid subscription only): http://secure.devart.com/ .

For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=20338 .

Post Reply