diff --git a/docs/ReleaseNotes.md b/docs/ReleaseNotes.md index 0a12e103d..fc8a72fae 100644 --- a/docs/ReleaseNotes.md +++ b/docs/ReleaseNotes.md @@ -8,10 +8,11 @@ Current package versions: ## Unreleased - TLS certificate/`TrustIssuer`: Check EKU in X509 chain checks when validating cerificates ([#2670 by NickCraver](https://github.com/StackExchange/StackExchange.Redis/pull/2670)) +- Fix [#2679](https://github.com/StackExchange/StackExchange.Redis/issues/2679) - blocking call in long-running connects ([#2680 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2680)) ## 2.7.33 -- **Potentiallty Breaking**: Fix `CheckTrustedIssuer` certificate validation for broken chain scenarios ([#2665 by NickCraver](https://github.com/StackExchange/StackExchange.Redis/pull/2665)) +- **Potentially Breaking**: Fix `CheckTrustedIssuer` certificate validation for broken chain scenarios ([#2665 by NickCraver](https://github.com/StackExchange/StackExchange.Redis/pull/2665)) - Users inadvertently trusting a remote cert with a broken chain could not be failing custom validation before this change. This is only in play if you are using `ConfigurationOptions.TrustIssuer` at all. - Add new `LoggingTunnel` API; see https://stackexchange.github.io/StackExchange.Redis/Logging ([#2660 by mgravell](https://github.com/StackExchange/StackExchange.Redis/pull/2660)) - Fix [#2664](https://github.com/StackExchange/StackExchange.Redis/issues/2664): Move ProcessBacklog to fully sync to prevent thread pool hopping and blocking on awaits ([#2667 by NickCraver](https://github.com/StackExchange/StackExchange.Redis/pull/2667)) diff --git a/src/StackExchange.Redis/ConnectionMultiplexer.cs b/src/StackExchange.Redis/ConnectionMultiplexer.cs index 022ae8cd9..fc00f0a9e 100644 --- a/src/StackExchange.Redis/ConnectionMultiplexer.cs +++ b/src/StackExchange.Redis/ConnectionMultiplexer.cs @@ -705,8 +705,17 @@ private static ConnectionMultiplexer ConnectImpl(ConfigurationOptions configurat // note that task has timeouts internally, so it might take *just over* the regular timeout var task = muxer.ReconfigureAsync(first: true, reconfigureAll: false, log, null, "connect"); - if (!task.Wait(muxer.SyncConnectTimeout(true))) + if (task.Wait(muxer.SyncConnectTimeout(true))) { + // completed promptly - we can check the outcome; hard failures + // (such as password problems) should be reported promptly - it + // won't magically start working + if (!task.Result) throw ExceptionFactory.UnableToConnect(muxer, muxer.failureMessage); + } + else + { + // incomplete - most likely slow initial connection; optionally + // allow a soft failure mode task.ObserveErrors(); if (muxer.RawConfig.AbortOnConnectFail) { @@ -720,7 +729,6 @@ private static ConnectionMultiplexer ConnectImpl(ConfigurationOptions configurat } } - if (!task.Result) throw ExceptionFactory.UnableToConnect(muxer, muxer.failureMessage); killMe = null; Interlocked.Increment(ref muxer._connectCompletedCount);