[SERVER-32912] killCursors on pinned cursor may not do anything Created: 25/Jan/18  Updated: 30/Oct/23  Resolved: 13/Feb/18

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 3.7.3

Type: Bug Priority: Major - P3
Reporter: Ian Boros Assignee: Bernard Gorman
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Query 2018-02-12, Query 2018-02-26
Participants:
Linked BF Score: 0

 Description   

If operation is running killCursors command while another is using the cursor, the killing operation will interrupt the operation using the cursor.

However, if the operation using the cursor is towards the end of a getMore (for example, serializing the batch to be sent, like it does here), it may not check for interrupts. This means that it will not delete the cursor when it completes, and that future {{getMore}}s will succeed.

To fix this, when a cursor is checked in (or unpinned) we should (under the cursor manager lock) check whether the operation was interrupted or not. If it was, we put the cursor into a special "killed" state so that the next attempt to check out the cursor results in an error (todo: discuss details more with Charlie. We could also just delete the cursor if this is super hard).

To test this we may have to add another failpoint in getMore at the end of the function, at which point there won't be any more checks for interrupts.



 Comments   
Comment by Githook User [ 14/Feb/18 ]

Author:

{'email': 'bernard.gorman@gmail.com', 'name': 'Bernard Gorman', 'username': 'gormanb'}

Message: SERVER-32912 Blacklist kill_pinned_cursor.js from sharding_last_stable_mongos_and_mixed_shards suite
Branch: master
https://github.com/mongodb/mongo/commit/755b04e335297e428bf5634e4bf72944c00df1a1

Comment by Githook User [ 13/Feb/18 ]

Author:

{'email': 'bernard.gorman@gmail.com', 'name': 'Bernard Gorman', 'username': 'gormanb'}

Message: SERVER-32912 Ensure that killCursors always invalidates a pinned cursor
Branch: master
https://github.com/mongodb/mongo/commit/1221b80ee0d65879a4c76ff98f78e92b53766cc0

Generated at Thu Feb 08 04:31:41 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.