[SERVER-22703] Database::createCollection may call ObOpserver::onCreateCollection on nullptr Created: 17/Feb/16  Updated: 26/Apr/16  Resolved: 15/Apr/16

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 3.3.5

Type: Bug Priority: Major - P3
Reporter: Andrew Morrow (Inactive) Assignee: Andrew Morrow (Inactive)
Resolution: Done Votes: 0
Labels: undefined-sanitizer
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Operating System: ALL
Steps To Reproduce:

Run rs_rollback_test under UBSAN

Sprint: Platforms 13 (04/22/16)
Participants:

 Description   

If there is no OpObserver in the global service context, the call may invoke a method through a nullptr:

See https://github.com/mongodb/mongo/blob/95ca58f7396c1c4e1c5e54caa81dda875ca87b57/src/mongo/db/catalog/database.cpp#L532

src/mongo/db/catalog/database.cpp:532:5: runtime error: member call on null pointer of type 'mongo::OpObserver'
    #0 0x11fa893 in mongo::Database::createCollection(mongo::OperationContext*, mongo::StringData, mongo::CollectionOptions const&, bool) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/db/catalog/database.cpp:532:5
    #1 0x1562be6 in mongo::update(mongo::OperationContext*, mongo::Database*, mongo::UpdateRequest const&, mongo::OpDebug*) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/db/ops/update.cpp:99:26
    #2 0x13384c0 in mongo::Helpers::putSingleton(mongo::OperationContext*, char const*, mongo::BSONObj) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/db/dbhelpers.cpp:259:5
    #3 0x17d25cc in mongo::repl::setMinValid(mongo::OperationContext*, mongo::repl::BatchBoundaries const&) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/db/repl/minvalid.cpp:109:9
    #4 0x100fd1a in (anonymous namespace)::RSRollbackTest::setUp() /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/db/repl/rs_rollback_test.cpp:164:5
    #5 0x1db5163 in mongo::unittest::Test::run() /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.cpp:140:5
    #6 0x10304e0 in void mongo::unittest::Suite::runTestObject<(anonymous namespace)::UnitTest__RSRollbackTest__InconsistentMinValid>() /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.h:405:9
    #7 0x1db693d in mongo::unittest::TestHolder::run() const /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.h:257:9
    #8 0x1db693d in mongo::unittest::Suite::run(std::string const&, int) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.cpp:263
    #9 0x1db7e07 in mongo::unittest::Suite::run(std::vector<std::string, std::allocator<std::string> > const&, std::string const&, int) /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest.cpp:321:27
    #10 0x1dbd0f7 in main /home/andrew/Documents/10gen/dev/src/mongodb/src/mongo/unittest/unittest_main.cpp:40:12
    #11 0x7ff47331ba3f in __libc_start_main /build/buildd/glibc-2.21/csu/libc-start.c:289
    #12 0xff70d8 in _start (/home/andrew/Documents/10gen/dev/src/mongodb/build/optdebug/mongo/db/repl/rs_rollback_test+0xff70d8)

This was detected in a unit test, so this may only be an issue when running the tests.



 Comments   
Comment by Githook User [ 15/Apr/16 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: SERVER-16221 SERVER-22703 ObOpserver may be nullptr in tests
Branch: master
https://github.com/mongodb/mongo/commit/9f1b2799bf446d8aea806523a574878fcfa6be62

Comment by Githook User [ 15/Apr/16 ]

Author:

{u'username': u'judahschvimer', u'name': u'Judah Schvimer', u'email': u'judah@mongodb.com'}

Message: Revert "SERVER-16221 SERVER-22703 ObOpserver may be nullptr in tests"

This reverts commit 716e0fa71c1e75fe5e0c791993f175f6b6407b39.
Branch: master
https://github.com/mongodb/mongo/commit/63d021f4107f4e48aa3c76629dd6dbd6abecb8e3

Comment by Githook User [ 15/Apr/16 ]

Author:

{u'username': u'acmorrow', u'name': u'Andrew Morrow', u'email': u'acm@mongodb.com'}

Message: SERVER-16221 SERVER-22703 ObOpserver may be nullptr in tests
Branch: master
https://github.com/mongodb/mongo/commit/716e0fa71c1e75fe5e0c791993f175f6b6407b39

Comment by Andy Schwerin [ 17/Feb/16 ]

This is only an issue in tests.

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