-
Type: Task
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
A possible race condition occurs in RetryState when MongoOperationTimeout is triggered during server selection. For instance, if the server selection timeout is set to 2 ms and the overall timeout (timeoutMS) is 100 ms, a MongoOperationTimeoutException might be thrown due to the server selection timeout expiring. However, since the overall timeout still has milliseconds remaining, RetryState may incorrectly handle the retry logic. This results in the previous attempt's exception being thrown as is, without being correctly wrapped in a MongoOperationTimeoutException.
Expected Behavior: The retry logic should recognize that a MongoOperationTimeoutException has been triggered outside the RetryState and correctly wrap the previous attempt exception in MongoOperationTimeoutException.
Actual Behavior: The retry logic fails to correctly wrap the previous attempt exception in a MongoOperationTimeoutException due to the remaining time in timeoutMS.