-
Type: Improvement
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: libmongoc
-
Labels:None
If the cursor iteration previously failed with a CursorNotFound(43) error, there should be no need to issue a killCursors command when destroying the mongoc_cursor_t. In fact, doing so could inadvertently kill a different cursor if the ID were to be reused between the application encountering a CursorNotFound error during iteration and ultimately calling mongoc_cursor_destroy.
This is something I noticed while implementing some contrived tests for PHPC-1274, which involved creating a cursor in a parent process, iterating it to completion in a forked child process, and then allowing the parent to destroy its cursor after waiting on the child to terminate.