[CSHARP-2109] Race condition in Drivers.Core.BinaryConnectionTests Created: 22/Nov/17 Updated: 28/Oct/23 Resolved: 28/Nov/17 |
|
| Status: | Closed |
| Project: | C# Driver |
| Component/s: | Testing |
| Affects Version/s: | None |
| Fix Version/s: | 2.5 |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Vincent Kam (Inactive) | Assignee: | Robert Stam |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
There appears to be a race condition in Drivers.Core.BinaryConnectionTests that makes the test fail on certain runs and pass on others. Specifically: MongoDB.Driver.Core.Connections.BinaryConnectionTests.SendMessageshould_throw_MongoConnectionClosedException_for_waiting_tasks On the same patch: |
| Comments |
| Comment by Githook User [ 28/Nov/17 ] | |||||||||||
|
Author: {'name': 'rstam', 'username': 'rstam', 'email': 'robert@robertstam.org'}Message: | |||||||||||
| Comment by Robert Stam [ 23/Nov/17 ] | |||||||||||
|
Extracting the setup code from the constructor to a helper method that can be called every iteration I am able to run the test as many times as I want. The first run of 10,000 iterations did not fail, but the second run did, so this can be reproduced locally. | |||||||||||
| Comment by Robert Stam [ 23/Nov/17 ] | |||||||||||
|
Even iterating just 2 times causes the test to fail. It turns out that these tests can't be run more than once because they depend on setup that is happening in the constructor, so the 2nd iteration isn't being properly initialized. I didn't realize this at first because when looking at the test it wasn't obvious that there was some initialization happening somewhere else. | |||||||||||
| Comment by Robert Stam [ 23/Nov/17 ] | |||||||||||
|
I can reliably make this test fail by putting the entire test body inside a for loop and iterating 1000 times. However, it is failing in a different way. The first SpinUntil is timing out. | |||||||||||
| Comment by Robert Stam [ 23/Nov/17 ] | |||||||||||
|
Here are the relevant lines from the log file:
|