SSL - Transport channel is closed when using DataReader
Posted: 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:
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".
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!
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);
}
}
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:
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()
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!