Skip to content

Commit 16ad04f

Browse files
authored
CSHARP-5744: Fix interruptInUse flaky tests (#1788)
1 parent ed33c63 commit 16ad04f

File tree

2 files changed

+0
-23
lines changed

2 files changed

+0
-23
lines changed

src/MongoDB.Driver/Core/Connections/BinaryConnection.cs

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,6 @@ public ResponseMessage ReceiveMessage(
421421
catch (Exception ex)
422422
{
423423
helper.FailedReceivingMessage(ex);
424-
ThrowOperationCanceledExceptionIfRequired(ex);
425424
throw;
426425
}
427426
}
@@ -457,7 +456,6 @@ public async Task<ResponseMessage> ReceiveMessageAsync(
457456
catch (Exception ex)
458457
{
459458
helper.FailedReceivingMessage(ex);
460-
ThrowOperationCanceledExceptionIfRequired(ex);
461459
throw;
462460
}
463461
}
@@ -540,7 +538,6 @@ public void SendMessage(OperationContext operationContext, RequestMessage messag
540538
catch (Exception ex)
541539
{
542540
helper.FailedSendingMessage(ex);
543-
ThrowOperationCanceledExceptionIfRequired(ex);
544541
throw;
545542
}
546543
}
@@ -577,7 +574,6 @@ public async Task SendMessageAsync(OperationContext operationContext, RequestMes
577574
catch (Exception ex)
578575
{
579576
helper.FailedSendingMessage(ex);
580-
ThrowOperationCanceledExceptionIfRequired(ex);
581577
throw;
582578
}
583579
}
@@ -687,19 +683,6 @@ ex is OperationCanceledException ||
687683
return new MongoConnectionException(_connectionId, message, ex);
688684
}
689685

690-
private void ThrowOperationCanceledExceptionIfRequired(Exception exception)
691-
{
692-
if (exception is ObjectDisposedException objectDisposedException)
693-
{
694-
// We expect two cases here:
695-
// objectDisposedException.ObjectName == GetType().Name
696-
// objectDisposedException.Message == "The semaphore has been disposed."
697-
// but since the last one is language-specific, the only option we have is avoiding any additional conditions for ObjectDisposedException
698-
// TODO: this logic should be reviewed in the scope of https://jira.mongodb.org/browse/CSHARP-3165
699-
throw new OperationCanceledException($"The {nameof(BinaryConnection)} operation has been cancelled.", exception);
700-
}
701-
}
702-
703686
// nested classes
704687
private class OpenConnectionHelper
705688
{

tests/MongoDB.Driver.Tests/Specifications/UnifiedTestSpecRunner.cs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -279,12 +279,6 @@ private static void RequireKmsMock() =>
279279
"collection.listIndexNames succeeds after retryable handshake network error",
280280

281281
// SDAM
282-
#if NET472
283-
// https://jira.mongodb.org/browse/CSHARP-3165
284-
"Connection pool clear uses interruptInUseConnections=true after monitor timeout",
285-
"Error returned from connection pool clear with interruptInUseConnections=true is retryable",
286-
"Error returned from connection pool clear with interruptInUseConnections=true is retryable for write",
287-
#endif
288282
// "Not implemented: https://jira.mongodb.org/browse/CSHARP-3138"
289283
"connectTimeoutMS=0",
290284
// https://jira.mongodb.org/browse/CSHARP-4459

0 commit comments

Comments
 (0)