[SERVER-22691] Incorrect initialization order in WiredTigerKVEngine Created: 17/Feb/16  Updated: 19/Nov/16  Resolved: 17/Feb/16

Status: Closed
Project: Core Server
Component/s: WiredTiger
Affects Version/s: 3.3.1
Fix Version/s: 3.2.4, 3.3.3

Type: Bug Priority: Major - P3
Reporter: Kyle Suarez Assignee: Kyle Suarez
Resolution: Done Votes: 0
Labels: code-only
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Completed:
Sprint: Integration 10 (02/22/16)
Participants:
Linked BF Score: 0

 Description   

In the WiredTigerKVEngine, an incorrect initialization order of private fields can lead to a race condition at shutdown. The KVEngine's SizeStorer is depended on by the JournalFlusher and so should be initialized beforehand to get the proper destruction order on shutdown.

In addition, shutdown calls for components of the KVEngine in WiredTigerKVEngine::cleanShutdown() should be reordered to match the actual order of destruction.



 Comments   
Comment by Githook User [ 17/Feb/16 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'ksuarz@gmail.com'}

Message: SERVER-22691 change WiredTigerKVEngine init order

The KVEngine's _journalFlusher depends on the _sizeStorer and so should be
initialized afterwards to prevent a use-after-free error on shutdown. The mutex
for _identToDrop should also initialized beforehand rather than after.

In addition, shutdown calls to internal components in
WiredTigerKVEngine::cleanShutdown() should be ordered in a way that matches
their actual destruction order.

(cherry picked from commit 95ca58f7396c1c4e1c5e54caa81dda875ca87b57)
Branch: v3.2
https://github.com/mongodb/mongo/commit/353875a593912ce454e9597f084d37bcebdc5df5

Comment by Githook User [ 17/Feb/16 ]

Author:

{u'username': u'ksuarz', u'name': u'Kyle Suarez', u'email': u'ksuarz@gmail.com'}

Message: SERVER-22691 change WiredTigerKVEngine init order

The KVEngine's _journalFlusher depends on the _sizeStorer and so should be
initialized afterwards to prevent a use-after-free error on shutdown. The mutex
for _identToDrop should also initialized beforehand rather than after.

In addition, shutdown calls to internal components in
WiredTigerKVEngine::cleanShutdown() should be ordered in a way that matches
their actual destruction order.
Branch: master
https://github.com/mongodb/mongo/commit/95ca58f7396c1c4e1c5e54caa81dda875ca87b57

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