Repository navigation
Closed
Labels
area-ExceptionHandling-coreclronly use for closed issuesin-prThere is an active PR which will close this issue when it is merged
Milestone
Description
See #53888
Note that Windows Checked is currently built using the -O1 compiler switch.
E.g.,
Assert failure(PID 7704 [0x00001e18], Thread: 7708 [0x1e1c]): FastNExportSEH(pEHR) || IsComPlusNestedExceptionRecord(pEHR) || ((ExecuteHandler2Module != NULL) && IsIPInModule(ExecuteHandler2Module, (PCODE)pEHR->Handler))
CORECLR! PopNestedExceptionRecords + 0xA0 (0x71127c40)
CORECLR! COMPlusEndCatch + 0x4A (0x711285da)
CORECLR! JIT_EndCatch + 0xE (0x71199e41)
CORECLR! CallDescrWorkerInternal + 0x34 (0x71199121)
CORECLR! CallDescrWorker + 0x13E (0x70da52ee)
CORECLR! CallDescrWorkerWithHandler + 0x189 (0x70da5589)
CORECLR! MethodDescCallSite::CallTargetWorker + 0x7A7 (0x70da5d77)
CORECLR! RunMainInternal + 0x2FE (0x70ae232e)
CORECLR! ``RunMain'::29'::__Body::Run'::5'::__Body::Run + 0x86 (0x70ae1c36)
CORECLR! RunMain'::29'::__Body::Run + 0xA3 (0x70ae1d53)
File: D:\workspace_work\1\s\src\coreclr\vm\i386\excepx86.cpp Line: 2054
Image: C:\h\w\B10F09DA\p\corerun.exe
and:
Assert failure(PID 3932 [0x00000f5c], Thread: 5880 [0x16f8]): Consistency check failed: Invalid transition into managed code!
We're walking this thread's stack and we've reached a managed frame at Esp=0x00F7D338. (The method is EHTest::f1) The very next FS:0 record (0x00F7D460) up from this point on the stack should be one of our 'unmanaged to managed SEH handlers', but its not... its something else, and that's very bad. It indicates that someone managed to call into managed code without setting up the proper exception handling.
Get a good unmanaged stack trace for this thread. All FS:0 records are on the stack, so you can see who installed the last handler. Somewhere between that function and where the thread is now is where the bad transition occurred.
A little extra info: FS:0 = 0x00F7C35C, pEHR->Handler = 0x70D12C3A
FAILED: IsUnmanagedToManagedSEHHandler(pEHR)
CORECLR! CHECK::Trigger + 0x3C4 (0x70a75264)
CORECLR! VerifyValidTransitionFromManagedCode + 0x18A (0x709e856a)
CORECLR! StackFrameIterator::NextRaw + 0xAE4 (0x705ca434)
CORECLR! Thread::StackWalkFramesEx + 0x421 (0x705cb681)
CORECLR! Thread::StackWalkFrames + 0x159 (0x705cb1c9)
CORECLR! LookForHandler + 0x1A (0x704959da)
CORECLR! CPFH_RealFirstPassHandler + 0xF57 (0x709e6007)
CORECLR! CPFH_FirstPassHandler + 0x1C0 (0x709e5020)
CORECLR! COMPlusFrameHandler + 0x26B (0x709e88db)
CORECLR! COMPlusNestedExceptionHandler + 0x13B (0x709e8a6b)
File: D:\workspace_work\1\s\src\coreclr\vm\i386\excepx86.cpp Line: 329
Image: C:\h\w\B10F09DA\p\corerun.exe
Metadata
Metadata
Assignees
Labels
area-ExceptionHandling-coreclronly use for closed issuesin-prThere is an active PR which will close this issue when it is merged
Activity
mangod9 commentedon Oct 4, 2021
Hi @BruceForstall, assume this fix is required to switch to
-O2, but looking through the PRs doesnt seem like there is consensus whether it should be switched?BruceForstall commentedon Oct 4, 2021
I'm still working on switching to
-O2because it makes the JIT about 10% faster, but my current attempt in #59235 simply works around this issue by not switching x86. The CI has been very noisy with failures recently, so I don't know if there are other lurking issues yet.I don't think there's any pushback; janvorli had some concerns about debuggability, but I think I addressed those.
mangod9 commentedon Oct 4, 2021
ok thanks for the context, so assume this issue isnt blocking your PR, but just something we should fix to enable
O2on x86 as well.Use /O2 for Windows x86 Checked (dotnet#122846)