[JAVA-3850] ChangeStream Publisher's cursor does not closed after .cancel() Created: 27/Sep/20 Updated: 01/Jun/22 Resolved: 08/Dec/20 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | Change Streams, Reactive Streams |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Ricky Chen | Assignee: | Ross Lawley |
| Resolution: | Duplicate | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
MongoDB 4.0.12, org.mongodb:mongodb-driver-reactivestreams:4.0.5 |
||
| Attachments: |
|
||||||||
| Issue Links: |
|
||||||||
| Description |
|
We start a Change Stream Publisher on a collection. Do not execute any operation on this collection at that time. The AsyncChangeStreamBatchCursor would call getMore command every second. Now we invoke subscription.cancel() method. The AsyncChangeStreamBatchCursor should be closed, but it doesn't. The property isOperationInProgress == true , isClosePending == true and the Cursor continue in getMore loop, never closed.
|
| Comments |
| Comment by Ross Lawley [ 08/Dec/20 ] | |||||||||||||||||||||||||||||
|
Fixed and pending release in 4.2.0 | |||||||||||||||||||||||||||||
| Comment by Jeffrey Yemin [ 30/Nov/20 ] | |||||||||||||||||||||||||||||
|
We're very close on | |||||||||||||||||||||||||||||
| Comment by João Ferreira [ 30/Nov/20 ] | |||||||||||||||||||||||||||||
|
Hi Ross. Any workaround while | |||||||||||||||||||||||||||||
| Comment by Ross Lawley [ 20/Nov/20 ] | |||||||||||||||||||||||||||||
|
This will be fixed as part of the | |||||||||||||||||||||||||||||
| Comment by Ross Lawley [ 06/Oct/20 ] | |||||||||||||||||||||||||||||
|
Thanks for the repro of the issue, I now understand the cause. The changestream is pending a result back from the server before closing - this is due to it internally implementation using cursor.next rather than cursor.tryNext. Scheduling to be fixed. Ross | |||||||||||||||||||||||||||||
| Comment by Ricky Chen [ 30/Sep/20 ] | |||||||||||||||||||||||||||||
|
This is my example. It can reproduce the problem on my shard MongoDB cluster, which has 100+ nodes. Log:
| |||||||||||||||||||||||||||||
| Comment by Ross Lawley [ 29/Sep/20 ] | |||||||||||||||||||||||||||||
|
Hi Ricky Chen, Many thanks for the ticket. Could you provide more detail on the bug? Either a full stacktrace or a test case to reproduce the error. Ideally, a minimal reproducible example as I could replicate the bug and use it as a test case for the fix. All the best, Ross |