Skip to content

FATAL_GC_ERROR produces hard to diagnose hangs or crashes #112599

@jkotas

Description

@jkotas

The crashes caused by FATAL_GC_ERROR are very hard to diagnose. I helped somebody to diagnose one of these and it took more than a day to find out what's causing the problem.
 

Repro

  1. Add unconditional FATAL_GC_ERROR(); to gc_heap::verify_free_lists
  2. set DOTNET_HeapVerify=1
  3. Run a simple test that just calls GC.Collect on x64 checked runtime

Actual behavior

This is one of the possible failure modes. I have also seen other asserts or hangs with mode complex tests.

Assert failure(PID 24832 [0x00006100], Thread: 16656 [0x4110]): unbreakableLockCount == m_pThread->GetUnbreakableLockCount() || (!m_pThread->HasUnbreakableLock() && !m_pThread->HasThreadStateNC(Thread::TSNC_OwnsSpinLock))

CORECLR! FCallCheck::~FCallCheck + 0x40 (0x00007ffa`68c11370)
CORECLR! CallSettingFrameEncoded + 0x2A (0x00007ffa`69185c8a)
CORECLR! _FrameHandler4::FrameUnwindToState + 0x28E (0x00007ffa`691844ce)
CORECLR! _FrameHandler4::FrameUnwindToEmptyState + 0x4B (0x00007ffa`6917c1eb)
CORECLR! _InternalCxxFrameHandler<__FrameHandler4> + 0x283 (0x00007ffa`691829c3)
CORECLR! _InternalCxxFrameHandlerWrapper<__FrameHandler4> + 0x6A (0x00007ffa`69182cba)
CORECLR! _CxxFrameHandler4 + 0xFB (0x00007ffa`6917d04b)
CORECLR! _GSHandlerCheck_EH4 + 0x90 (0x00007ffa`69179070)
NTDLL! chkstk + 0x11F (0x00007ffb`04a43f8f)
NTDLL! RtlUnwindEx + 0x352 (0x00007ffb`048f4d22)
    File: C:\runtime\src\coreclr\vm\fcall.cpp:196
    Image: C:\runtime\artifacts\bin\coreclr\windows.x64.Checked\corerun.exe

Expected behavior

Error message that suggests fatal GC error. No hangs or crashes.

Metadata

Metadata

Assignees

Labels

area-ExceptionHandling-coreclrin-prThere is an active PR which will close this issue when it is mergedtenet-reliabilityReliability/stability related issue (stress, load problems, etc.)

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions