[SERVER-27411] session cache concurrency issues at shutdown Created: 13/Dec/16  Updated: 06/Dec/17  Resolved: 23/Aug/17

Status: Closed
Project: Core Server
Component/s: Storage
Affects Version/s: None
Fix Version/s: 3.5.12

Type: Bug Priority: Major - P3
Reporter: Eric Milkie Assignee: Daniel Gottlieb (Inactive)
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
is related to SERVER-16031 Race condition at shutdown for KVEngines Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v3.4
Sprint: Storage 2017-09-11
Participants:
Linked BF Score: 15

 Description   

At shutdown time, after acquiring a Global X lock, shutdownTask() calls shutdownGlobalStorageEngineCleanly(). On WiredTiger, this calls __conn_close(), which proceeds to close all open sessions.

Problematically, the destructor for ScopedTransaction calls abandonSnapshot(), which calls _txnClose(). _txnClose accesses a session, managed by the WiredTigerSessionCache. Because no DB locks are held by ScopedTransaction, accessing sessions in ScopedTransaction by threads other than the one in shutdownTask() can race with the closing of these sessions by the WT shutdown code. This can possibly result in a null pointer exception at shutdown time.



 Comments   
Comment by Ramon Fernandez Marina [ 24/Aug/17 ]

Author:

{'username': u'dgottlieb', 'name': u'Daniel Gottlieb', 'email': u'daniel.gottlieb@mongodb.com'}

Message:SERVER-27411: Abandon snapshots before locks are released.

The storage engine may only be accessed by clients holding the Global lock in
at least MODE_IS. Otherwise, during shutdown or in the future, Recover to a
Timestamp, there can be a race where the storage engine is accessed while it
is being destroyed or expects acquiescence from the system.
Branch:master
https://github.com/mongodb/mongo/commit/3b8719aecf7541ee83738d9241bfcbc1281b6ed2

Comment by Daniel Gottlieb (Inactive) [ 23/Aug/17 ]

commit 3b8719aecf7541ee83738d9241bfcbc1281b6ed2 (HEAD -> master, origin/master, origin/HEAD)
Author: Daniel Gottlieb <daniel.gottlieb@mongodb.com>
Date:   Tue Aug 22 21:39:06 2017 -0400
 
    SERVER-27411: Abandon snapshots before locks are released.
    
    The storage engine may only be accessed by clients holding the Global lock in
    at least MODE_IS. Otherwise, during shutdown or in the future, Recover to a
    Timestamp, there can be a race where the storage engine is accessed while it
    is being destroyed or expects acquiescence from the system.

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