Skip to content

Commit 566a6b0

Browse files
author
Gabriela Martinez
committed
Merge remote-tracking branch 'remotes/origin/6.8' into 6.9
2 parents 347a873 + b83fafc commit 566a6b0

File tree

5 files changed

+51
-17
lines changed

5 files changed

+51
-17
lines changed

CHANGES

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
- Fix for EF5 and EF6 wrong SQL statement to set primary key (MySQL Bug 76292, Oracle Bug #20711384)
44
- Fixed problem where mysql.proc tables would not be used for metadata even though access was available (MySQL Bug #74116, Oracle Bug #20960373)
55
- Added support for TLSv1.1 and TLSv1.2
6+
- Fixed Fix for "Aborted connection" (MySQL Bug #80997, Oracle Bug # 23346197).
67

78

89
6.9.8

Source/MySql.Data/Driver.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2004, 2015, Oracle and/or its affiliates. All rights reserved.
1+
// Copyright © 2004, 2016, Oracle and/or its affiliates. All rights reserved.
22
//
33
// MySQL Connector/NET is licensed under the terms of the GPLv2
44
// <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -58,7 +58,7 @@ internal class Driver : IDisposable
5858
private bool firstResult;
5959
protected IDriver handler;
6060
internal MySqlDataReader reader;
61-
private bool disposeInProgress;
61+
private bool disposed;
6262
internal bool isFabric;
6363

6464
/// <summary>
@@ -540,15 +540,11 @@ public virtual void CloseQuery(MySqlConnection connection, int statementId)
540540
protected virtual void Dispose(bool disposing)
541541
{
542542
// Avoid cyclic calls to Dispose.
543-
if (disposeInProgress)
543+
if (disposed)
544544
return;
545-
546-
disposeInProgress = true;
547-
548545
try
549546
{
550547
ResetTimeout(1000);
551-
if (disposing)
552548
handler.Close(isOpen);
553549
// if we are pooling, then release ourselves
554550
if (connectionString.Pooling)
@@ -563,7 +559,7 @@ protected virtual void Dispose(bool disposing)
563559
{
564560
reader = null;
565561
isOpen = false;
566-
disposeInProgress = false;
562+
disposed = true;
567563
}
568564
}
569565

Tests/MySql.Data.Tests/GetSchemaTests.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2013, 2015 Oracle and/or its affiliates. All rights reserved.
1+
// Copyright © 2013, 2016 Oracle and/or its affiliates. All rights reserved.
22
//
33
// MySQL Connector/NET is licensed under the terms of the GPLv2
44
// <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -279,7 +279,7 @@ public void CanGetSchemaInformationGeneratedColumns()
279279
if (st.Version.Major >= 5 && st.Version.Minor >= 7 && st.Version.Build >= 6)
280280
{
281281
Assert.Equal("char", dt.Rows[2]["DATA_TYPE"]);
282-
Assert.Equal("Name", dt.Rows[2]["GENERATION_EXPRESSION"]);
282+
Assert.Equal("Name", (dt.Rows[2]["GENERATION_EXPRESSION"]).ToString().Replace("`",""));
283283
Assert.Equal("STORED GENERATED", dt.Rows[2]["EXTRA"]);
284284
}
285285
}

Tests/MySql.Data.Tests/MySqlConnectionTests.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1342,5 +1342,44 @@ public void SslOverrided()
13421342
}
13431343
}
13441344
}
1345+
1346+
1347+
1348+
/// <summary>
1349+
/// Fix for aborted connections MySQL bug 80997 OraBug 23346197
1350+
/// </summary>
1351+
[Fact]
1352+
public void MarkConnectionAsClosedProperlyWhenDisposing()
1353+
{
1354+
MySqlConnection con = new MySqlConnection(st.GetConnectionString(true));
1355+
con.Open();
1356+
var cmd = new MySqlCommand("show global status like 'aborted_clients'", con);
1357+
MySqlDataReader r = cmd.ExecuteReader();
1358+
r.Read();
1359+
int numClientsAborted = r.GetInt32(1);
1360+
r.Close();
1361+
1362+
AppDomain appDomain = FullTrustSandbox.CreateFullTrustDomain();
1363+
FullTrustSandbox sandbox = (FullTrustSandbox)appDomain.CreateInstanceAndUnwrap(
1364+
typeof(FullTrustSandbox).Assembly.FullName,
1365+
typeof(FullTrustSandbox).FullName);
1366+
try
1367+
{
1368+
MySqlConnection connection = sandbox.TryOpenConnection("server=localhost;userid=root;pwd=;port=3305");
1369+
Assert.NotNull(connection);
1370+
Assert.True(connection.State == ConnectionState.Open);
1371+
}
1372+
finally
1373+
{
1374+
AppDomain.Unload(appDomain);
1375+
}
1376+
1377+
r = cmd.ExecuteReader();
1378+
r.Read();
1379+
int numClientsAborted2 = r.GetInt32(1);
1380+
r.Close();
1381+
Assert.Equal(numClientsAborted, numClientsAborted);
1382+
con.Close();
1383+
}
13451384
}
13461385
}

Tests/MySql.Data.Tests/TimeoutAndCancel.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright © 2013 Oracle and/or its affiliates. All rights reserved.
1+
// Copyright © 2013, 2016 Oracle and/or its affiliates. All rights reserved.
22
//
33
// MySQL Connector/NET is licensed under the terms of the GPLv2
44
// <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
@@ -269,17 +269,14 @@ public void ConnectionStringModifiedAfterCancel()
269269
return;
270270

271271
connStr = connStr.Replace("persist security info=true", "persist security info=false");
272-
273-
int threadId;
272+
274273
using (MySqlConnection c = new MySqlConnection(connStr))
275274
{
276-
c.Open();
277-
threadId = c.ServerThread;
275+
c.Open();
278276
string connStr1 = c.ConnectionString;
279277

280278
MySqlCommand cmd = new MySqlCommand("SELECT SLEEP(5)", c);
281279
cmd.CommandTimeout = 1;
282-
283280
try
284281
{
285282
using (MySqlDataReader reader = cmd.ExecuteReader())
@@ -293,8 +290,9 @@ public void ConnectionStringModifiedAfterCancel()
293290
}
294291
string connStr2 = c.ConnectionString.ToLower(CultureInfo.InvariantCulture);
295292
Assert.Equal(connStr1.ToLower(CultureInfo.InvariantCulture), connStr2);
293+
c.Close();
296294
}
297-
st.execSQL("kill " + threadId);
295+
298296
}
299297

300298

0 commit comments

Comments
 (0)