[JAVA-3675] Change Streams: KillCursor command fails with "error 143 (CursorInUse)" Created: 01/Apr/20 Updated: 27/Oct/23 Resolved: 15/Apr/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: | David Giger | Assignee: | John Stewart (Inactive) |
| Resolution: | Gone away | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Attachments: |
|
| Description |
|
Hi,
I've built an application using the reactive mongoDB driver for Java. The user can subscribe to updates from a collection using WebSockets, so he can be notified if new data has been inserted. However, when calling dispose() of the change stream subscription, the DB returns the following error: command sent by the driver:
response from the server:
(full stack trace in the attachment) I've implemented the same functionality using the reactive template as well as calling .watch() on the collection "manually". Both implementations produced the same error. The implementation is as follows: A method returns a Flux of Document (or a ChangeStreamPublisher of Document) from which I then subscribe to using subscribe(). The resulting Disposable is assigned to a variable, which is then used to call dispose() if the client cancels the change stream updates. After calling dispose() the driver sends the killCursors command and the above error is thrown. The error does not impact any of my logic and I haven't found a way to catch it either. The getMore operation is successfully killed on the server and no data insert events are pushed to the client any more. Googling for this error code returned nothing useful, so I don't have anything to go off. I would be glad if you guys could either tell me what I'm doing wrong or if this is actually a bug in the driver (possible racing condition?).
Cheers and keep up the great work! David |
| Comments |
| Comment by David Giger [ 06/Apr/20 ] |
|
Hi John, Yes I can give that a shot. I'll let you know of the outcomes.
Cheers, |
| Comment by John Stewart (Inactive) [ 06/Apr/20 ] |
|
david@akenza.com Reviewing the stack trace you provided, it aligns exactly with the stack trace for |
| Comment by David Giger [ 06/Apr/20 ] |
|
Hi Jeffrey, Thanks for your reply! We use a replica set hosted on MongoDB Atlas with edition/version "MongoDB 3.6.17 Enterprise". Regarding driver version, I'm using the Maven artifact "mongodb-driver-async" with version "3.11.2". It's a dependency of "spring-boot-starter-data-mongodb-reactive" which we're using to build our Services with.
Cheers, |
| Comment by Jeffrey Yemin [ 06/Apr/20 ] |
|
Hi david@akenza.com, please let us know what version of the driver and server you are using, and whether it's a replica set or sharded cluster. |
| Comment by David Giger [ 01/Apr/20 ] |
|
I've added the file stacktrace_for_callback_error.txt. This is the error which is thrown by the package "org.mongodb.driver.operation" when the above MongoException is thrown. Cheers, |