[SERVER-28022] Accessing cursor with pending data after forcing system.namespaces record move may cause crash Created: 15/Feb/17  Updated: 05/Apr/17  Resolved: 16/Feb/17

Status: Closed
Project: Core Server
Component/s: MMAPv1
Affects Version/s: None
Fix Version/s: 3.0.15, 3.2.13, 3.4.3, 3.5.4

Type: Bug Priority: Major - P3
Reporter: Maria van Keulen Assignee: Maria van Keulen
Resolution: Done Votes: 0
Labels: bkp
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
is depended on by SERVER-27199 audit places where we call deleteReco... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.4, v3.2, v3.0
Steps To Reproduce:

    let dbInvalidName = 'system_namespaces_invalidations';
    let dbInvalid = db.getSiblingDB(dbInvalidName);
    let num_collections = 3;
    dbInvalid.dropDatabase();
    for (let i = 0; i < num_collections; i++) {
        assert.commandWorked(dbInvalid.createCollection('coll' + i.toString()));
    }
    let cmd = {find: 'system.namespaces'};
    Object.extend(cmd, {batchSize: 3, showRecordId: true});
    let res = dbInvalid.runCommand(cmd);
    assert.commandWorked(res, 'could not run ' + tojson(cmd));
    printjson(res);
    let cursor = new DBCommandCursor(dbInvalid.getMongo(), res);
    let errMsg =
        'expected more data from command ' + tojson(cmd) + ', with result ' + tojson(res);
    assert(cursor.hasNext(), errMsg);
    let coll = dbInvalid['coll1'];
    let modCmd ={collMod: 'coll1', validator: { $or:
        [
        { phone: { $type: "string" } },
        { email: { $regex: /@mongodb\.com$/ } },
        { status: { $in: [ "Unknown", "Incomplete" ] } },
        { address: { $type: "string" } },
        { ssn: { $type: "string" } },
        { favoriteBook: { $type: "string" } },
        { favoriteColor: { $type: "string" } },
        { favoriteBeverage: { $type: "string" } },
        { favoriteDay: { $type: "string" } },
        { favoriteFood: { $type: "string" } },
        { favoriteSport: { $type: "string" } },
        { favoriteMovie: { $type: "string" } },
        { favoriteShow: { $type: "string" } }
        ]
    }};
    assert.commandWorked(dbInvalid.runCommand(modCmd));
    assert.gt(cursor.itcount(), 0, errMsg);

Sprint: Storage 2017-03-06
Participants:

 Description   

Another example of SERVER-27199, we do not invalidate the old record ID for a system.namespaces record that needs to be moved to a larger space. Executing the steps to reproduce may cause a crash.



 Comments   
Comment by Githook User [ 31/Mar/17 ]

Author:

{u'username': u'mvankeulen94', u'name': u'Maria van Keulen', u'email': u'maria@mongodb.com'}

Message: SERVER-28022 Invalidate old IDs for moved system.namespaces records

(cherry picked from commit b21ff4b1a89bf90a3cceee6961c75f8d10c733e6)

Conflicts:
src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp
src/mongo/db/storage/mmap_v1/mmap_v1_database_catalog_entry.h
Branch: v3.0
https://github.com/mongodb/mongo/commit/356c1a17b36b165704183e8696fcac3b2d32deb0

Comment by Githook User [ 10/Mar/17 ]

Author:

{u'username': u'mvankeulen94', u'name': u'Maria van Keulen', u'email': u'maria@mongodb.com'}

Message: SERVER-28022 Invalidate old IDs for moved system.namespaces records

(cherry picked from commit 22ec4be075233d425f21349854b5ceac6baa5289)

Conflicts:
src/mongo/db/storage/mmap_v1/catalog/namespace_details_collection_entry.cpp
Branch: v3.2
https://github.com/mongodb/mongo/commit/b21ff4b1a89bf90a3cceee6961c75f8d10c733e6

Comment by Githook User [ 06/Mar/17 ]

Author:

{u'username': u'mvankeulen94', u'name': u'Maria van Keulen', u'email': u'maria@mongodb.com'}

Message: SERVER-28022 Invalidate old IDs for moved system.namespaces records

(cherry picked from commit 22ec4be075233d425f21349854b5ceac6baa5289)
Branch: v3.4
https://github.com/mongodb/mongo/commit/1ce2bb9f88d621136e8a624e1f48d7d2af8f1c12

Comment by Githook User [ 16/Feb/17 ]

Author:

{u'username': u'mvankeulen94', u'name': u'Maria van Keulen', u'email': u'maria@mongodb.com'}

Message: SERVER-28022 Invalidate old IDs for moved system.namespaces records
Branch: master
https://github.com/mongodb/mongo/commit/22ec4be075233d425f21349854b5ceac6baa5289

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