MySQL Lists are EOL. Please join:

List:MySQL and .NET« Previous MessageNext Message »
From:THOULON Pierre-Yves Date:October 18 2004 3:06pm
Subject:Hung datareader
View as plain text  
	I get a hung datareader when I try to close it. This is on WinServer 2003, with MySQL
v4.1.5 gamma, with MyConnector/.NET bits from Oct 5th. It used to work with 1.0 beta 1 but
I had to get more recent bits to overcome the NULL column problem. Note that I haven't
tried more recent bits, having problems compiling them (see previous posting, sorry...).
	Sequence of events:
	- Prepare everything for the connection
	- Send out several commands that work
	- then (sqlCmd is a MySqlCommand object):
	sqlCmd->CommandText = "use mydatabase; show tables;";
	MySqlDataReader* rdr = sqlCmd->ExecuteReader();
	while (rdr->Read()) {
	    String* tblname = rdr->GetString(0);
	    // do something with tblname
	rdr->Close(); //hangs
	Hangs on line (in PacketReader.cs/OpenReader(); this line just never returns; no
exception, no nothing):
	packetLength = stream.ReadByte() +  (stream.ReadByte() << 8) + (stream.ReadByte()
<< 16);

	Dump of the call stack at hang time (when pausing the debugger)

	*	00000000() 
	*	system.dll!System.Net.Sockets.Socket.Receive(byte[] buffer = {Length=4096}, int offset
= 0, int size = 4096, System.Net.Sockets.SocketFlags socketFlags = None) + 0x14e bytes  
	*	system.dll!System.Net.Sockets.NetworkStream.Read(byte[] buffer = {Length=4096}, int
offset = 0, int size = 4096) + 0x150 bytes  
	*	mscorlib.dll!System.IO.BufferedStream.ReadByte() + 0x87 bytes  
	*!MySql.Data.MySqlClient.PacketReader.OpenPacket() Line 83 + 0xe bytes 
	*!MySql.Data.MySqlClient.NativeDriver.ReadResult(ulong affectedRows = 0,
long lastInsertId = 0, MySql.Data.MySqlClient.ServerStatusFlags serverStatus = 10, int
warningCount = 0, string serverMessage = null) Line 385 
	*!MySql.Data.MySqlClient.CommandResult.ReadNextResult(bool isFirst =
false) Line 117 + 0x2c bytes 
reader = <undefined value>) Line 300 + 0x13 bytes 
	*!MySql.Data.MySqlClient.MySqlCommand.Consume() Line 273 + 0xa bytes 
	*!MySql.Data.MySqlClient.MySqlDataReader.Close() Line 128

	After a bit more investigation, I was able to circumvent the problem by splitting the
command line into two separate commands: "use mydatabase" with a
sqlCmd->ExecuteNonQuery(), followed by a "show tables;" with ExecuteReader().
	It used to work on ByteFX 0.76 and on Connector/.NET 1.0 beta , so I'm curious: is it
illegal to concatenate several command and send a single Execute, or are there other
precautions to be taken ?

Hung datareaderTHOULON Pierre-Yves18 Oct
  • Re: Hung datareaderReggie Burnett20 Oct
RE: Hung datareaderTHOULON Pierre-Yves21 Oct
  • Stability for 4.0Jordan Sparks21 Oct
    • Re: Stability for 4.0Barry Zubel21 Oct
      • Re: Stability for 4.0Reggie Burnett21 Oct
        • Re: Stability for 4.0Barry Zubel22 Oct
Re: Stability for 4.0Barry Zubel21 Oct