[SERVER-29056] InitialSyncer::_startupComponent should reset 'component' before returning CallbackCanceled due to shutdown Created: 03/May/17  Updated: 30/Oct/23  Resolved: 05/May/17

Status: Closed
Project: Core Server
Component/s: Replication
Affects Version/s: 3.4.4, 3.5.6
Fix Version/s: 3.4.6, 3.5.7

Type: Bug Priority: Major - P3
Reporter: Benety Goh Assignee: Benety Goh
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
is related to SERVER-28214 Recoverable Rollback: Fallback to 3.4... Closed
Backwards Compatibility: Fully Compatible
Backport Completed:
Participants:
Linked BF Score: 15

 Description   

_startupComponent currently resets the unique_ptr if the component's startup() returns an error but not when the parent component is shutting down. This usually doesn't pose a problem except when the sub component is holding some resource that needs to be released if we decide not to proceed with calling its startup().

https://github.com/mongodb/mongo/blob/fa2dcc33303dd6a2080c108e121da6984d08a9d6/src/mongo/db/repl/initial_syncer.cpp#L1340

initial_syncer.cpp

1337
template <typename Component>
1338
Status InitialSyncer::_startupComponent_inlock(Component& component) {
1339
    if (_isShuttingDown_inlock()) {
1340
        return Status(ErrorCodes::CallbackCanceled,
1341
                      "initial syncer shutdown while trying to call startup() on component");
1342
    }
1343
    auto status = component->startup();
1344
    if (!status.isOK()) {
1345
        component.reset();
1346
    }
1347
    return status;
1348
}



 Comments   
Comment by Githook User [ 14/Jun/17 ]

Author:

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

Message: SERVER-29056 InitialSyncer::_startupComponent_inlock() resets unique_ptr to 'component' if it fails to due to shutdown

(cherry picked from commit c0cb0e97ee8d7831653865a2410e3ea9b084a8f8)
Branch: v3.4
https://github.com/mongodb/mongo/commit/c6dddd2e43f150793da4a6201758fd48db33e025

Comment by Githook User [ 05/May/17 ]

Author:

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

Message: SERVER-29056 InitialSyncer::_startupComponent_inlock() resets unique_ptr to 'component' if it fails to due to shutdown
Branch: master
https://github.com/mongodb/mongo/commit/c0cb0e97ee8d7831653865a2410e3ea9b084a8f8

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