Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/coreclr/debug/di/dbgtransportmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ DbgTransportTarget::DbgTransportTarget()
// Initialization routine called only by the DbgTransportManager.
HRESULT DbgTransportTarget::Init()
{
m_sLock.Init("DbgTransportTarget Lock", RSLock::cLockFlat, RSLock::LL_DBG_TRANSPORT_TARGET_LOCK);
// The Unix loader does not invoke DbgDllMain DLL_PROCESS_DETACH for mscordbi at process exit,
// so Shutdown() may never run. Mark the lock as allowing leak to skip the destructor assert.
m_sLock.Init("DbgTransportTarget Lock", RSLock::cLockFlat | RSLock::cLockAllowLeak, RSLock::LL_DBG_TRANSPORT_TARGET_LOCK);

return S_OK;
}
Expand Down
4 changes: 4 additions & 0 deletions src/coreclr/debug/di/rspriv.h
Original file line number Diff line number Diff line change
Expand Up @@ -716,6 +716,10 @@ class RSLock
// to count this lock in m_cTotalDbgApiLocks, which is asserted to be 0 on entry
// to public APIs. Example of such a lock: LL_SHIM_PROCESS_DISPOSE_LOCK
cLockNonDbgApi = 0x00000004,

// Skip the leak assert in the destructor. Use for static-lifetime locks
// whose owning shutdown path is not guaranteed to run.
cLockAllowLeak = 0x00000008,
};

// To prevent deadlocks, we order all locks.
Expand Down
6 changes: 3 additions & 3 deletions src/coreclr/debug/di/rspriv.inl
Original file line number Diff line number Diff line change
Expand Up @@ -504,9 +504,9 @@ inline RSLock::RSLock()

inline RSLock::~RSLock()
{
// If this lock is still ininitialized, then no body ever deleted the critical section
// for it and we're leaking.
CONSISTENCY_CHECK_MSGF(!IsInit(), ("Leaking Critical section for RS Lock '%s'", m_szTag));
// If this lock is still initialized, then nobody ever deleted the critical section
// for it and we're leaking. cLockAllowLeak opts out of this assert.
CONSISTENCY_CHECK_MSGF(!IsInit() || (m_eAttr & cLockAllowLeak), ("Leaking Critical section for RS Lock '%s'", m_szTag));
}
#endif

Expand Down