[SERVER-31117] Invariant failure ccPin == ErrorCodes::QueryPlanKilled Created: 17/Sep/17  Updated: 08/Jan/24  Resolved: 20/Sep/17

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 3.6.0-rc0

Type: Bug Priority: Major - P3
Reporter: A. Jesse Jiryu Davis Assignee: Mira Carey
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File mongod.log    
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Platforms 2017-10-02
Participants:

 Description   

Running PyMongo's test suite, on the branch where I'm implementing sessions, I crashed a standalone mongod running with auth.

2017-09-17T10:44:54.724-0400 F -        [conn384] Invariant failure ccPin == ErrorCodes::QueryPlanKilled src/mongo/db/query/find.cpp 330
 
 mongod(_ZN5mongo15invariantFailedEPKcS1_j+0x2E6) [0x10f4c1666]
 mongod(_ZN5mongo7getMoreEPNS_16OperationContextEPKcixPbS4_+0x18E2) [0x10e49fd52]
 mongod(_ZN5mongo23ServiceEntryPointMongod13handleRequestEPNS_16OperationContextERKNS_7MessageE+0x1528) [0x10e179378]
 mongod(_ZN5mongo19ServiceStateMachine15_processMessageERNS0_11ThreadGuardE+0x18A) [0x10e186a8a]
 mongod(_ZN5mongo19ServiceStateMachine15_runNextInGuardERNS0_11ThreadGuardE+0x175) [0x10e185f45]
 mongod(_ZN5mongo19ServiceStateMachine7runNextEv+0x38) [0x10e1868b8]
 mongod(_ZNSt3__110__function6__funcIZN5mongo21ServiceEntryPointImpl12startSessionENS_10shared_ptrINS2_9transport7SessionEEEE3$_1NS_9allocatorIS8

Log attached.
I think that PyMongo was executing some part of this test:

    def test_aggregate_raw(self):
        c = self.db.test
        c.drop()
        docs = [{'_id': i, 'x': 3.0 * i} for i in range(10)]
        c.insert_many(docs)
        batches = list(c.aggregate_raw_batches([{'$sort': {'_id': 1}}]))
        self.assertEqual(1, len(batches))
        self.assertEqual(docs, decode_all(batches[0]))

PyMongo's aggregate_raw_batches method sets the initial batch size to 0 with the "aggregate" command, then issues a "getMore".



 Comments   
Comment by Githook User [ 20/Sep/17 ]

Author:

{'email': 'jcarey@argv.me', 'name': 'Jason Carey', 'username': 'hanumantmk'}

Message: SERVER-31117 pin can return unauthorized

Being too specific about pinCursor error code returns causes an
unauthorized legacy getMore to invariant.
Branch: master
https://github.com/mongodb/mongo/commit/dc84bdb8db1446d21fde5e59cf7b0df1149871ac

Comment by A. Jesse Jiryu Davis [ 19/Sep/17 ]

Based on mira.carey@mongodb.com's diagnosis in SERVER-31120, my PyMongo code was probably sending a different lsid with getMore than with aggregate.

Comment by A. Jesse Jiryu Davis [ 17/Sep/17 ]

Reproduced here too with a patch build of PyMongo:

https://evergreen.mongodb.com/task/mongo_python_driver_tests_windows_vs2015_python_version__auth_ssl~auth_ssl_windows_vs2015_python_version~3.6_test_latest_standalone_patch_200b699ba553979afa543e33eefc44276a532477_59be8ccf2fbabe322000001f_17_09_17_14_55_12

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