Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2603

Fix racy test in ChangeStreamOperationSpecification

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 3.6.0
    • Affects Version/s: None
    • Component/s: Test Coverage
    • Labels:
      None

      The test "should support return the expected results" in ChangeStreamOperationSpecification is racy. Because closing an asynchronous cursor is itself asynchronous, in some cases the cleanup checks in ServerHelper#checkPool can run before the close completes, resulting in the following failure:

      java.lang.IllegalStateException: Connection pool in use count is 1
      	at com.mongodb.connection.ServerHelper.checkPool(ServerHelper.java:60)
      	at com.mongodb.connection.ServerHelper.checkPool(ServerHelper.java:34)
      	at com.mongodb.OperationFunctionalSpecification.cleanup(OperationFunctionalSpecification.groovy:69)
      

      So far, I haven't seen this in the debugger or on evergreen, but I can reproduce it with a local replica set with this command line:

      ./gradlew -Dorg.mongodb.test.uri=mongodb://jeff:27017,jeff:27018/?replicaset=replset driver-core:test
      

            Assignee:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Reporter:
            jeff.yemin@mongodb.com Jeffrey Yemin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: