Description
AsyncChangeStreamBatchCursor#close doesn't protect against being called multiple times, which on the second invocation results in an extra release of the AsyncReadBinding.
java.lang.IllegalStateException: Attempted to decrement the reference count below 0
|
at com.mongodb.internal.binding.AbstractReferenceCounted.release(AbstractReferenceCounted.java:39)
|
at com.mongodb.async.client.ClientSessionBinding.release(ClientSessionBinding.java:140)
|
at com.mongodb.internal.operation.AsyncChangeStreamBatchCursor.close(AsyncChangeStreamBatchCursor.java:87)
|
at com.mongodb.async.client.MongoIterableSubscription.postTerminate(MongoIterableSubscription.java:69)
|
at com.mongodb.async.client.AbstractSubscription.unsubscribe(AbstractSubscription.java:59)
|
at com.mongodb.reactivestreams.client.internal.ObservableToPublisher$1$1.cancel(ObservableToPublisher.java:58)
|
at com.mongodb.reactivestreams.client.syncadapter.SyncMongoCursor.close(SyncMongoCursor.java:78)
|
at com.mongodb.reactivestreams.client.syncadapter.SyncChangeStreamIterable$1.close(SyncChangeStreamIterable.java:53)
|
at com.mongodb.client.AbstractChangeStreamsTest.shouldPassAllOutcomes(AbstractChangeStreamsTest.java:120)
|
The close method should be protected, as it is in the synchronous driver