List:MySQL and .NET« Previous MessageNext Message »
From:James Moore Date:February 13 2005 6:43pm
Subject:Chasing a problem with an exception "Unable to write data to the transport connection"
View as plain text  
Been chasing this for a while with no success, so I thought I'd see if
anyone has any thoughts.  Next thing on my list is to try it using an ODBC
connector.

Connector 1.0.4 talking to 4.1.9 server; server is running on a redhat 7.3
box.  Haven't installed 4.1.X server on the windows side, but was seeing the
same issue when talking to a 4.0.21 server running on the same machine as
the .Net app.

My application runs fine for an hour or so, happily reading and writing to
the database, until I finally get a System.IO.IOException.  I don't see
anything unusual in the server logs; nothing shows up in the mysql server
error log; the last entry is

/usr/local/mysql/bin/mysqld: ready for connections.
Version: '4.1.9-max-log'  socket: '/tmp/mysql.sock'  port: 3306  Official
MySQL-
max binary

The one consistent thing is that the exception comes from this loop:

		public static int [] QueryToInts (IDbCommand cmd) 
		{
			// Debug.WriteLine ("Qeyrry is \n" +
cmd.CommandText);
			IntCollection result = new IntCollection ();
			using (IDataReader reader = cmd.ExecuteReader
(CommandBehavior.Default)) 
			{
				while (reader.Read ()) 
				{
					int i = reader.GetInt32 (0);
					result.Add (i);
				}
			}
			return result;
		}

Or a very similar one that calls GetString instead of getInt32.  I don't see
the problem if I'm reading or writing via a dataset/adapter.

Here's the stack trace for the exception:

Unhandled Exception: System.IO.IOException: Unable to write data to the
transport connection. ---> System.Net.Sockets.SocketException: An existing
connection was forcibly closed by the remote host
   at System.Net.Sockets.Socket.Send(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags)
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset,
Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Write(Byte[] buffer, Int32 offset,
Int32 size)
   at System.IO.BufferedStream.FlushWrite()
   at System.IO.BufferedStream.Flush()
   at MySql.Data.MySqlClient.PacketWriter.WriteChunk(Byte[] buf, Int32
offset, Int32 length) in
C:\Projects\salmon\mysqlconnector\MySqlClient\PacketWriter.cs:line 170
   at MySql.Data.MySqlClient.PacketWriter.Write(Byte[] buffer, Int32 offset,
Int32 count) in
C:\Projects\salmon\mysqlconnector\MySqlClient\PacketWriter.cs:line 183
   at MySql.Data.MySqlClient.NativeDriver.ExecuteCommand(DBCmd cmd, Byte[]
bytes, Int32 length) in
C:\Projects\salmon\mysqlconnector\MySqlClient\NativeDriver.cs:line 114
   at MySql.Data.MySqlClient.NativeDriver.SendQuery(Byte[] bytes, Int32
length, Boolean consume) in
C:\Projects\salmon\mysqlconnector\MySqlClient\NativeDriver.cs:line 345
   at MySql.Data.MySqlClient.MySqlCommand.GetNextResultSet(MySqlDataReader
reader) in C:\Projects\salmon\mysqlconnector\MySqlClient\command.cs:line 299
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult() in
C:\Projects\salmon\mysqlconnector\MySqlClient\datareader.cs:line 624
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior
behavior) in C:\Projects\salmon\mysqlconnector\MySqlClient\command.cs:line
402
   at
MySql.Data.MySqlClient.MySqlCommand.System.Data.IDbCommand.ExecuteReader(Com
mandBehavior behavior) in
C:\Projects\salmon\mysqlconnector\MySqlClient\command.cs:line 369
   at Com.Banshee.Utilities.DataSetUtils.QueryToStrings(IDbCommand cmd) in
C:\Projects\salmon\ComBansheeUtilities\MiscUtilities\BansheeUtils.cs:line
884
   at Com.Banshee.NntpServerLink.ArticleDecoder.PartialFiles() in
C:\Projects\salmon\grunion\Articles\ArticleDecoder.cs:line 222
   at Com.Banshee.NntpServerLink.ArticleDecoder.watcher_Created(Object
sender, FileSystemEventArgs e) in
C:\Projects\salmon\grunion\Articles\ArticleDecoder.cs:line 258
   at System.IO.FileSystemWatcher.OnCreated(FileSystemEventArgs e)
   at System.IO.FileSystemWatcher.NotifyFileSystemEventArgs(Int32 action,
String name)
   at System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode,
UInt32 numBytes, NativeOverlapped* overlappedPointer)caught exception for
sendCommandVerbose: Unable to read data from the transport connection.
An unhandled exception of type 'System.IO.IOException' occurred in
system.dll

Thread
Date casting problemKevin Turner13 Feb
  • RE: Date casting problemJordan Sparks13 Feb
RE: Date casting problemKevin Turner13 Feb
  • RE: Date casting problemJordan Sparks13 Feb
    • Re: Date casting problemBen Reichelt13 Feb
RE: Date casting problemKevin Turner13 Feb
  • RE: Date casting problemJames Moore13 Feb
    • RE: Date casting problemReggie Burnett23 Feb
  • Chasing a problem with an exception "Unable to write data to the transport connection"James Moore13 Feb
    • Re: Chasing a problem with an exception "Unable to write data to the transport connection"Jorge Bastos13 Feb
    • Re: Chasing a problem with an exception "Unable to write data tothe transport connection"Guy Platt12 Apr
      • Re: Chasing a problem with an exception "Unable to write data tothe transport connection"Guy Platt12 Apr
      • Re: Chasing a problem with an exception "Unable to write data to thetransport connection"SGreen12 Apr