-
Type: New Feature
-
Resolution: Unresolved
-
Priority: Major - P3
-
None
-
Component/s: None
In SERVER-32169 we noticed that it's easy to miss bugs in drivers' killCursors implementations. The killCursors command can fail but still report "ok: 1", listing the cursor ids it failed to kill in the "cursorsAlive" array:
> db.runCommand({killCursors: "collection", cursors: [NumberLong(0)]}) { ok: 1, cursorsNotFound: [NumberLong(0)], cursorsKilled: [], cursorsAlive: [] }
If your driver already includes tests that prove it really can kill a cursor, then you don't need to do anything. For example, PyMongo can't always kill a cursor with MongoDB 3.7.x due to SERVER-32169, and this was discovered because three of PyMongo's tests fail with MongoDB 3.7.x. If you driver has tests which fail due to SERVER-32169 then you may be able to validate this ticket already. Otherwise, here's a suggested test.
Write a test in each driver that checks we really kill a cursor:
- insert 1000 documents into a collection
- do a "find" on the collection and iterate the cursor past the first document
- store the cursor id in a variable
- assert the cursor id is nonzero
- kill the cursor (explicitly, or by letting it go out of scope, depending on the driver)
- assert that the driver receives a server reply to "killCursors" with "ok: 1", an empty "cursorsNotFound" array, an empty "cursorsAlive" array, an empty "cursorsUnknown" array, and a "cursorsKilled" array with one element equal to the cursor id
Drivers can use Command Monitoring, if they've implemented it, to check the server reply.
- depends on
-
CXX-1479 Test that killCursors really succeeds
- Backlog
-
RUST-167 Test that killCursors really succeeds
- Backlog
-
CDRIVER-2417 Test that killCursors really succeeds
- Closed
-
CSHARP-2119 Test that killCursors really succeeds
- Closed
-
GODRIVER-144 Test that killCursors really succeeds
- Closed
-
NODE-1214 Test that killCursors really succeeds
- Closed
-
PYTHON-1433 Test that killCursors really succeeds
- Closed
-
PHPC-1056 Test that killCursors really succeeds
- Closed
-
RUBY-1265 Test that killCursors really succeeds
- Closed
-
JAVA-2691 Ensure that core driver integration tests execute with a session where possible
- Closed
- related to
-
SERVER-32169 A cursor created with a session cannot be killed outside that session
- Closed