[SERVER-22109] Invariant failure when running applyOps to create an index with a bad ns field Created: 08/Jan/16  Updated: 25/Jan/17  Resolved: 14/Jan/16

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 3.0.8, 3.2.0
Fix Version/s: 3.0.9, 3.2.3, 3.3.1

Type: Bug Priority: Major - P3
Reporter: Kamran K. Assignee: Benety Goh
Resolution: Done Votes: 0
Labels: code-and-test
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Related
is related to SERVER-21583 ApplyOps background index creation ma... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Sprint: Repl E (01/08/16), Repl F (01/29/16)
Participants:
Linked BF Score: 0

 Description   

The applyOps command can trigger an invariant failure when creating an index via a system.indexes write.

Invariant failure _name == nsToDatabaseSubstring(ns)
 
* thread #17: tid = 0xe8569, 0x00007fff9a36370e libsystem_kernel.dylib`__write_nocancel + 10
  * frame #0: 0x00007fff9a36370e libsystem_kernel.dylib`__write_nocancel + 10
    frame #1: 0x00007fff936f3202 libsystem_c.dylib`_swrite + 87
    frame #2: 0x00007fff936eb72c libsystem_c.dylib`__sflush + 87
    frame #3: 0x00007fff936ee040 libsystem_c.dylib`__sfvwrite + 823
    frame #4: 0x00007fff936ee34a libsystem_c.dylib`fwrite + 153
    frame #5: 0x00007fff8730438c libc++.1.dylib`std::__1::__stdoutbuf<char>::overflow(int) + 84
    frame #6: 0x00007fff872fa1cd libc++.1.dylib`std::__1::basic_streambuf<char, std::__1::char_traits<char> >::xsputn(char const*, long) + 73
    frame #7: 0x00007fff873011cd libc++.1.dylib`std::__1::basic_ostream<char, std::__1::char_traits<char> >::write(char const*, long) + 73
    frame #8: 0x0000000100051545 mongod`mongo::operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, mongo::StringData)(stream=0x00007fff76a102f8, value=(_data = "\n\n***aborting after invariant() failure\n\n\n", _size = 42)) + 69 at string_data.cpp:57
    frame #9: 0x000000010112b53b mongod`mongo::logger::MessageEventDetailsEncoder::encode(this=0x0000000105017f30, event=0x0000700000825918, os=0x00007fff76a102f8) + 731 at message_event_utf8_encoder.cpp:77
    frame #10: 0x0000000100761be0 mongod`mongo::logger::ConsoleAppender<mongo::logger::MessageEventEphemeral, mongo::Console>::append(this=0x0000000105013320, event=0x0000700000825918) + 192 at console_appender.h:53
    frame #11: 0x000000010112c0ae mongod`mongo::logger::LogDomain<mongo::logger::MessageEventEphemeral>::append(this=0x00000001050132d8, event=0x0000700000825918) + 574 at log_domain-impl.h:59
    frame #12: 0x0000000101128299 mongod`mongo::logger::LogstreamBuilder::~LogstreamBuilder(this=0x0000700000825e48) + 1401 at logstream_builder.cpp:129
    frame #13: 0x0000000101128c45 mongod`mongo::logger::LogstreamBuilder::~LogstreamBuilder(this=0x0000700000825e48) + 21 at logstream_builder.cpp:121
    frame #14: 0x00000001014b800e mongod`mongo::invariantFailed(expr="_name == nsToDatabaseSubstring(ns)", file="src/mongo/db/catalog/database.cpp", line=429) + 382 at assert_util.cpp:152
    frame #15: 0x000000010031ac5d mongod`mongo::Database::getCollection(this=0x0000000105011be0, ns=(_data = "u", _size = 1)) const + 141 at database.cpp:429
    frame #16: 0x0000000100752363 mongod`mongo::IndexBuilder::_build(this=0x0000700000827158, txn=0x0000000105012f20, db=0x0000000105011be0, allowBackgroundBuilding=false, dbLock=0x0000000000000000) const + 323 at index_builder.cpp:128
    frame #17: 0x0000000100753372 mongod`mongo::IndexBuilder::buildInForeground(this=0x0000700000827158, txn=0x0000000105012f20, db=0x0000000105011be0) const + 50 at index_builder.cpp:110
    frame #18: 0x0000000100bfca0c mongod`mongo::repl::applyOperation_inlock(txn=0x0000000105012f20, db=0x0000000105011be0, op=0x000070000082a418, convertUpdateToUpsert=true, incrementOpsAppliedStats=mongo::repl::IncrementOpsAppliedStatsFn @ 0x000070000082a900)>) + 3164 at oplog.cpp:754
    frame #19: 0x00000001002d713a mongod`mongo::applyOps(txn=0x0000000105012f20, dbName="admin", applyOpCmd=0x000070000082aeb0, result=0x000070000082b040) + 4394 at apply_ops.cpp:141
    frame #20: 0x0000000100371c72 mongod`mongo::ApplyOpsCmd::run(this=0x00000001029a6e00, txn=0x0000000105012f20, dbname="admin", cmdObj=0x000070000082aeb0, (null)=0, errmsg="", result=0x000070000082b040) + 658 at apply_ops.cpp:112
    frame #21: 0x00000001004ceeca mongod`mongo::Command::run(this=0x00000001029a6e00, txn=0x0000000105012f20, request=0x000070000082bed0, replyBuilder=0x000070000082c080) + 3690 at dbcommands.cpp:1441
    frame #22: 0x00000001004cdb30 mongod`mongo::Command::execCommand(txn=0x0000000105012f20, command=0x00000001029a6e00, request=0x000070000082bed0, replyBuilder=0x000070000082c080) + 5264 at dbcommands.cpp:1326
    frame #23: 0x000000010036f6a6 mongod`mongo::runCommands(txn=0x0000000105012f20, request=0x000070000082bed0, replyBuilder=0x000070000082c080) + 2118 at commands.cpp:498
    frame #24: 0x0000000100765f34 mongod`mongo::(anonymous namespace)::receivedRpc(txn=0x0000000105012f20, client=0x0000000105130f20, dbResponse=0x000070000082d430, message=0x000070000082db90) + 628 at instance.cpp:304
    frame #25: 0x0000000100762edd mongod`mongo::assembleResponse(txn=0x0000000105012f20, m=0x000070000082db90, dbresponse=0x000070000082d430, remote=0x000070000082d1b0) + 2301 at instance.cpp:525
    frame #26: 0x000000010000c24d mongod`mongo::MyMessageHandler::process(this=0x0000000105011180, m=0x000070000082db90, port=0x0000000105012500) + 397 at db.cpp:171


Version: 176fad1a68fd9d0750a3aa4b33c2eb20be7d39ec



 Comments   
Comment by Githook User [ 14/Jan/16 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-22109 applyOps should validate database name in index spec when creating indexes

(cherry picked from commit 3fa4cdc79b04639061f0d13b68b60c3e3e5102b6)
Branch: v3.0
https://github.com/mongodb/mongo/commit/761473b023c938d50c8835599514667fbd8b6dd9

Comment by Githook User [ 14/Jan/16 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-22109 applyOps should validate database name in index spec when creating indexes

(cherry picked from commit 3fa4cdc79b04639061f0d13b68b60c3e3e5102b6)
Branch: v3.2
https://github.com/mongodb/mongo/commit/000cc6041846ac1e658e915dea7ecab0f030218c

Comment by Githook User [ 14/Jan/16 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-22109 applyOps should validate database name in index spec when creating indexes
Branch: master
https://github.com/mongodb/mongo/commit/3fa4cdc79b04639061f0d13b68b60c3e3e5102b6

Comment by Benety Goh [ 13/Jan/16 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-22109 validate index spec namespace in applyOperation_inlock

(cherry picked from commit 51f0cfa865fe090a5208d5bff47faa5fbe6a92c1)
Branch: v3.0
https://github.com/mongodb/mongo/commit/28fe476b7e7e8d43461f20384b7072cd83ad30b7

Comment by Benety Goh [ 13/Jan/16 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-22109 validate index spec namespace in applyOperation_inlock

(cherry picked from commit 51f0cfa865fe090a5208d5bff47faa5fbe6a92c1)
Branch: v3.2
https://github.com/mongodb/mongo/commit/0da900911bd76b07bd734b51820411f13e510210

Comment by Githook User [ 11/Jan/16 ]

Author:

{u'username': u'benety', u'name': u'Benety Goh', u'email': u'benety@mongodb.com'}

Message: SERVER-22109 validate index spec namespace in applyOperation_inlock
Branch: master
https://github.com/mongodb/mongo/commit/51f0cfa865fe090a5208d5bff47faa5fbe6a92c1

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