Skip to content

Commit c4d66c0

Browse files
committed
Switch DeferConnectionReset default value to true.
There have been a number of bug reports about connection pool exhaustion with the previous value of 'false' that this setting needs additional testing before it can be on by default.
1 parent 31ca1b1 commit c4d66c0

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

docs/content/connection-options.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ Connection pooling is enabled by default. These options are used to configure it
191191
</tr>
192192
<tr id="DeferConnectionReset">
193193
<td>Defer Connection Reset, DeferConnectionReset</td>
194-
<td><code>false</code></td>
195-
<td>If <code>true</code>, the connection state is not reset until the connection is retrieved from the pool. This was the default behaviour before MySqlConnector 1.3. The default value of <code>false</code> resets connections in the background after they’re closed which makes opening a connection faster, and releases server resources sooner.</td>
194+
<td><code>true</code></td>
195+
<td>If <code>true</code>, the connection state is not reset until the connection is retrieved from the pool. The experimental value of <code>false</code> resets connections in the background after they’re closed which can make opening a connection faster, and releases server resources sooner; however, there are reports of connection pool exhaustion when using this value.</td>
196196
</tr>
197197
<tr id="MaxPoolSize">
198198
<td>Maximum Pool Size, Max Pool Size, MaximumPoolsize, maxpoolsize</td>

src/MySqlConnector/MySqlConnectionStringBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -643,7 +643,7 @@ static MySqlConnectionStringOption()
643643

644644
AddOption(DeferConnectionReset = new(
645645
keys: new[] { "Defer Connection Reset", "DeferConnectionReset" },
646-
defaultValue: false));
646+
defaultValue: true));
647647

648648
AddOption(ConnectionIdlePingTime = new(
649649
keys: new[] { "Connection Idle Ping Time", "ConnectionIdlePingTime" },

tests/MySqlConnector.Tests/MySqlConnectionStringBuilderTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public void Defaults()
3636
Assert.False(csb.ConnectionReset);
3737
#else
3838
Assert.True(csb.ConnectionReset);
39-
Assert.False(csb.DeferConnectionReset);
39+
Assert.True(csb.DeferConnectionReset);
4040
#endif
4141
Assert.Equal(15u, csb.ConnectionTimeout);
4242
Assert.False(csb.ConvertZeroDateTime);

0 commit comments

Comments
 (0)