Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix jit attach hang at Shutdown #67166

Merged
merged 1 commit into from
Mar 26, 2022
Merged
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
12 changes: 12 additions & 0 deletions src/coreclr/debug/ee/debugger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6946,6 +6946,18 @@ BOOL Debugger::PreJitAttach(BOOL willSendManagedEvent, BOOL willLaunchDebugger,

LOG( (LF_CORDB, LL_INFO10000, "D::PreJA: Entering\n") );

if (m_fShutdownMode)
{
// Trying to JitAttach because of some failure at shutdown is likely to block because we
// would suspend any thread that isn't the finalizer or debugger helper thread when it tries to
// take the debugger lock below. By bailing out here we won't do the JitAttach as we normally
// would, but at least the app should exit with an unhandled exception or FailFast rather
// entering a hung state. We believe this is very rare scenario so mitigating the problem in
// this way is sufficient.
LOG( (LF_CORDB, LL_INFO10000, "D::PreJA: Leaving - shutdown case\n") );
return FALSE;
}

// Multiple threads may be calling this, so need to take the lock.
if(!m_jitAttachInProgress)
{
Expand Down