Bug #102129 | Hang in MySqlConnection.Close after TransactionScope times out | ||
---|---|---|---|
Submitted: | 1 Jan 2021 23:00 | Modified: | 17 Jan 2022 19:21 |
Reporter: | Bradley Grainger (OCA) | Email Updates: | |
Status: | Can't repeat | Impact on me: | |
Category: | Connector / NET | Severity: | S2 (Serious) |
Version: | 8.0.22 | OS: | Windows (10) |
Assigned to: | CPU Architecture: | Other (x64) |
[1 Jan 2021 23:00]
Bradley Grainger
[4 Jan 2021 6:30]
MySQL Verification Team
Hello Bradley, Thank you for the report and test case. With the provided test case I'm getting below Unhandled Exception: - C/NET 8.0.22, VS 2019, .NET framework 4.8 using MySql.Data.MySqlClient; using System; using System.Transactions; namespace Bug102129 { class Program { static void Main(string[] args) { var transactionScope = new TransactionScope(TransactionScopeOption.Required, TimeSpan.FromSeconds(1)); var connection = new MySqlConnection("server=xxx;port=3333;userid = ushastry; password = mysql123;AutoEnlist=true"); connection.Open(); Console.WriteLine("Executing command"); using (var command = new MySqlCommand("DO SLEEP(2);", connection)) command.ExecuteNonQuery(); Console.WriteLine("Executed command"); connection.Close(); // delays for 30 seconds; then sometimes succeeds, sometimes throws NullReferenceException connection.Dispose(); Console.WriteLine("Closed connection"); transactionScope.Complete(); } } } Unhandled Exception: System.Transactions.TransactionAbortedException: The transaction has aborted. at MySql.Data.MySqlClient.Interceptors.ExceptionInterceptor.Throw(Exception exception) at MySql.Data.MySqlClient.MySqlConnection.Throw(Exception ex) at MySql.Data.MySqlClient.MySqlCommand.Throw(Exception ex) at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior) at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader() at MySql.Data.MySqlClient.Driver.LoadServerProperties(MySqlConnection connection) at MySql.Data.MySqlClient.Driver.Configure(MySqlConnection connection) at MySql.Data.MySqlClient.MySqlConnection.Open() at Bug102129.Program.Main(String[] args) in C:\Work\MySQLNet\Bug102129\Bug102129\Program.cs:line 14 Press any key to continue . . . Am I missing anything here? Please let me know. Thank you! regards, Umesh
[13 Jan 2021 14:07]
Bradley Grainger
I tested this again. I don't get the exception I reported when targeting "net48" (.NET Framework 4.8), but I do get it when targeting "net5.0" (.NET 5.0). So it appears this bug may be framework-specific.
[18 Jan 2021 8:24]
MySQL Verification Team
Thank you for the feedback.
[17 Jan 2022 19:21]
Daniel Valdez
Posted by developer: Could not be reproduced using the latest release of Connector/NET, v8.0.27.