Bug #85978 | UPDATE Timeout then ExecuteReader returns null | ||
---|---|---|---|
Submitted: | 18 Apr 2017 2:55 | Modified: | 10 Aug 2022 17:32 |
Reporter: | Matt Houser | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | Connector / NET | Severity: | S2 (Serious) |
Version: | 6.9.9 | OS: | Windows |
Assigned to: | CPU Architecture: | Any | |
Tags: | Timeout ExecuteReader |
[18 Apr 2017 2:55]
Matt Houser
[18 Apr 2017 3:10]
Matt Houser
Hypothesis: 1. Connection times-out and is returned to the pool. 2. Connection is pulled from the pool, and is immediately in the "MySqlException.IsQueryAborted" state. ??
[18 Apr 2017 11:53]
Chiranjeevi Battula
Hello Matt Houser, Thank you for the bug report. I could not repeat the issue at our end using with Visual Studio 2013, Connector/NET 6.9.9 version. Could you please provide repeatable test case (exact steps/sample project, screenshot etc. - please make it as private if you prefer) to confirm this issue at our end? Thanks, Chiranjeevi.
[19 Apr 2017 18:38]
Matt Houser
I have determined that the initial UPDATE times-out due to a slow query (45 seconds).
[19 Apr 2017 18:39]
Matt Houser
I have been trying to create a demo program, but I have not been able to yet. However, I did create bug #86010 which seems related in that SLEEP appears to be "interrupted" after the timeout. The reason I bring this up, is that (according to the MySql connector code in GitHub) ExecuteReader can return null if the query was interrupted. See MySqlException.IsQueryAborted https://dev.mysql.com/doc/refman/5.7/en/error-messages-server.html#error_er_query_interrup...
[19 Apr 2017 20:29]
Matt Houser
OK. I can make it happen on demand now. Step 1. Create this table: CREATE TABLE `TestTable` ( `Id` int(11) NOT NULL AUTO_INCREMENT, `Value` varchar(45) DEFAULT NULL, `Value2` int(11) DEFAULT NULL, PRIMARY KEY (`Id`) ) ENGINE=InnoDB; Step 2. Put a breakpoint on line 28 and run the attached demonstration program. Step 4. When your breakpoint is hit, run the following against your MySql database: LOCK TABLES `TestTable` read; SET @sl = SLEEP(45); UNLOCK TABLES; Step 5. While that is running, before it completes, continue the execution of the demonstration app. "ExecuteUpdateNoSleep" should block until the lock clears. A timeout exception should occur. Step 6. Witness when ExecuteReader returns null in the subsequent attempt to UPDATE the record. But there's no reason this UPDATE should fail.
[19 Apr 2017 20:29]
Matt Houser
Demonstration Program
Attachment: Program.cs (text/plain), 5.27 KiB.
[21 Apr 2017 9:55]
Chiranjeevi Battula
Hello Matt Houser, Thank you for the feedback and test case. Verified this behavior on Visual Studio 2013 (C#.Net) and Connector/NET 6.9.9 version. Thanks, Chiranjeevi.
[21 Apr 2017 9:55]
Chiranjeevi Battula
Screenshot
Attachment: 85978.JPG (image/jpeg, text), 252.71 KiB.
[21 Apr 2017 14:28]
Matt Houser
Hello Chiranjeevi, Your screenshot is displaying the wrong exception. Your screenshot is showing the timeout exception, which is expected to occur due to the table lock. However, this bug is about the null value returned from ExecuteReader which occurs later in the demonstration program. Please confirm.
[10 Aug 2022 17:32]
Daniel Valdez
This bug could not be reproduced and all the steps on "How to Repeat" section, executed successfully.