Bug #87307 NextResult hangs instead of throwing timeout exception
Submitted: 3 Aug 2017 15:53 Modified: 20 Mar 2020 21:04
Reporter: Bradley Grainger (OCA) Email Updates:
Status: Can't repeat Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:6.9.9 OS:Windows (10.0.15063 x64)
Assigned to: CPU Architecture:Any

[3 Aug 2017 15:53] Bradley Grainger
Description:
A call to MySqlDataReader.NextResult hangs when executing "SELECT SLEEP(n)" if n is in the range [CommandTimeout + 1, CommandTimeout * 2].

How to repeat:
Executing the following code will hang:

cmd.CommandText = "SELECT 1; SELECT SLEEP(7);";
cmd.CommandTimeout = 5;
using (var reader = cmd.ExecuteReader())
{
	Console.WriteLine(reader.Read()); // true
	Console.WriteLine(reader.GetValue(0)); // 1
	Console.WriteLine(reader.NextResult()); // *** HANGS ***
}

I can reproduce the hang with "SELECT SLEEP(n)" values from 6-10. With "SELECT SLEEP(4)", NextResult returns true. With "SELECT SLEEP(11)", it throws a TimeoutException. (This also seems like a bug; I would have expected a MySqlException.)
[3 Aug 2017 15:54] Bradley Grainger
Repro program

Attachment: Program.cs (text/plain), 803 bytes.

[4 Aug 2017 6:33] Chiranjeevi Battula
Hello Bradley Grainger,

Thank you for the bug report and test case.
Verified this behavior on Visual Studio 2013 (C#.Net) and Connector/NET 6.9.9 version.

Thanks,
Chiranjeevi.
[4 Aug 2017 6:33] Chiranjeevi Battula
Screenshot

Attachment: 87307.JPG (image/jpeg, text), 178.81 KiB.

[20 Mar 2020 21:04] Daniel Valdez
Posted by developer:
 
This bug could not be reproduced using the latest release, Connector NET v8.0.19.