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

Contract violation in GC Profiler test #67630

Closed
jkoritzinsky opened this issue Apr 6, 2022 · 10 comments · Fixed by #70924
Closed

Contract violation in GC Profiler test #67630

jkoritzinsky opened this issue Apr 6, 2022 · 10 comments · Fixed by #70924
Assignees
Labels
area-GC-coreclr blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' blocking-clean-ci-optional Blocking optional rolling runs

Comments

@jkoritzinsky
Copy link
Member

      Assert failure(PID 776 [0x00000308], Thread: 2580 [0x0a14]): CONTRACT VIOLATION by SimpleRWLock::TryEnterRead at "D:\a\_work\1\s\src\coreclr\vm\simplerwlock.cpp" @ 27
      
      CAN_TAKE_LOCK called in a CANNOT_TAKE_LOCK region.
      
                              CONTRACT in VirtualCallStubManager::FindStubManager at "D:\a\_work\1\s\src\coreclr\vm\virtualcallstub.cpp" @ 969
                              GCX_NOTRIGGER in CLRVectoredExceptionHandlerPhase3 at "D:\a\_work\1\s\src\coreclr\vm\excep.cpp" @ 7489
      VIOLATED-->  CONTRACT in ProfToEEInterfaceImpl::GetObjectGeneration at "D:\a\_work\1\s\src\coreclr\vm\proftoeeinterfaceimpl.cpp" @ 9000
                              CONTRACT in EEToProfInterfaceImpl::GarbageCollectionFinished at "D:\a\_work\1\s\src\coreclr\vm\eetoprofinterfaceimpl.cpp" @ 5889
                              CONTRACT in GarbageCollectionFinishedCallback at "D:\a\_work\1\s\src\coreclr\vm\proftoeeinterfaceimpl.cpp" @ 693
                              GCX_COOP in GCInterface_Collect at "D:\a\_work\1\s\src\coreclr\vm\comutilnative.cpp" @ 1006
                              CONTRACT in GCInterface_Collect at "D:\a\_work\1\s\src\coreclr\vm\comutilnative.cpp" @ 997
                              CONTRACT in MethodDescCallSite::CallTargetWorker at "D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp" @ 280
                              GCX_COOP in Assembly::ExecuteMainMethod at "D:\a\_work\1\s\src\coreclr\vm\assembly.cpp" @ 1570
                              CONTRACT in Assembly::ExecuteMainMethod at "D:\a\_work\1\s\src\coreclr\vm\assembly.cpp" @ 1554
                              GCX_COOP in CorHost2::ExecuteAssembly at "D:\a\_work\1\s\src\coreclr\vm\corhost.cpp" @ 357
                              CONTRACT in CorHost2::ExecuteAssembly at "D:\a\_work\1\s\src\coreclr\vm\corhost.cpp" @ 306
      
      
      
      CORECLR! CONTRACT_ASSERT + 0x307 (0x00007ff9`59b12ef7)
      CORECLR! ClrDebugState::LockTaken + 0x76 (0x00007ff9`59c008a6)
      CORECLR! SimpleRWLock::TryEnterRead + 0xB0 (0x00007ff9`5a0817e0)
      CORECLR! SimpleRWLock::EnterRead + 0xA2 (0x00007ff9`5a0812b2)
      CORECLR! LockedRangeList::IsInRangeWorker + 0x3D (0x00007ff9`59b270ad)
      CORECLR! VirtualCallStubManager::getStubKind + 0x103 (0x00007ff9`59cd5ee3)
      CORECLR! VirtualCallStubManager::FindStubManager + 0x116 (0x00007ff9`59df98c6)
      CORECLR! AdjustContextForVirtualStub + 0x53 (0x00007ff9`5a205223)
      CORECLR! CLRVectoredExceptionHandlerPhase3 + 0x2CF (0x00007ff9`59c3a4bf)
      CORECLR! CLRVectoredExceptionHandlerPhase2 + 0x91 (0x00007ff9`59c39f81)
          File: D:\a\_work\1\s\src\coreclr\vm\simplerwlock.cpp Line: 27
          Image: C:\h\w\BACC0A33\p\CoreRun.exe

In https://helixre8s23ayyeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-67599-merge-26eaddf607184fe28a/profiler.gc/1/console.82d7f3ce.log?sv=2019-07-07&se=2022-04-25T18%3A57%3A26Z&sr=c&sp=rl&sig=wd65GZnAyydb6efKQdfc0TtHGmIGeTWwgyU5S255L9M%3D

@dotnet-issue-labeler dotnet-issue-labeler bot added the untriaged New issue has not been triaged by the area owner label Apr 6, 2022
@dotnet-issue-labeler
Copy link

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

@janvorli
Copy link
Member

janvorli commented Apr 6, 2022

This looks like the primary issue is a null reference somewhere in the call chain of the ProfToEEInterfaceImpl::GetObjectGeneration, which results in a vectored exception handler being called and doing its stuff. So it is not a problem of the contract itself, as an access violation exception is not expected to happen in native runtime code.
I'm taking a look at the core dump of that failure to see where it happened.

@janvorli
Copy link
Member

janvorli commented Apr 6, 2022

Here is the full stack trace:

0:000> k
 # Child-SP          RetAddr           Call Site
00 00000098`92b773b0 00007ff9`5a2f4b0b KERNELBASE!RaiseFailFastException+0xae
01 (Inline Function) --------`-------- coreclr!TerminateOnAssert+0x19 [D:\a\_work\1\s\src\coreclr\utilcode\debug.cpp @ 189] 
02 00000098`92b77980 00007ff9`5a2f4135 coreclr!_DbgBreakCheck+0x4fb [D:\a\_work\1\s\src\coreclr\utilcode\debug.cpp @ 427] 
03 00000098`92b77b30 00007ff9`5a2f43af coreclr!_DbgBreakCheckNoThrow+0x55 [D:\a\_work\1\s\src\coreclr\utilcode\debug.cpp @ 534] 
04 00000098`92b77be0 00007ff9`59b12ef7 coreclr!DbgAssertDialog+0x1af [D:\a\_work\1\s\src\coreclr\utilcode\debug.cpp @ 695] 
05 00000098`92b77d00 00007ff9`59c008a6 coreclr!CONTRACT_ASSERT+0x307 [D:\a\_work\1\s\src\coreclr\inc\contract.inl @ 593] 
06 (Inline Function) --------`-------- coreclr!ClrDebugState::CheckOkayToLock+0x4d [D:\a\_work\1\s\src\coreclr\inc\contract.inl @ 215] 
07 00000098`92b7b3d0 00007ff9`5a0817e0 coreclr!ClrDebugState::LockTaken+0x76 [D:\a\_work\1\s\src\coreclr\inc\contract.inl @ 246] 
08 00000098`92b7b420 00007ff9`5a0812b2 coreclr!SimpleRWLock::TryEnterRead+0xb0 [D:\a\_work\1\s\src\coreclr\vm\simplerwlock.cpp @ 30] 
09 00000098`92b7b470 00007ff9`59b270ad coreclr!SimpleRWLock::EnterRead+0xa2 [D:\a\_work\1\s\src\coreclr\vm\simplerwlock.cpp @ 68] 
0a (Inline Function) --------`-------- coreclr!SimpleRWLock::AcquireReadLock+0x5 [D:\a\_work\1\s\src\coreclr\vm\simplerwlock.hpp @ 115] 
0b (Inline Function) --------`-------- coreclr!FunctionBase<SimpleRWLock *,&SimpleRWLock::AcquireReadLock,&SimpleRWLock::ReleaseReadLock>::DoAcquire+0x5 [D:\a\_work\1\s\src\coreclr\inc\holder.h @ 711] 
0c (Inline Function) --------`-------- coreclr!BaseHolder<SimpleRWLock *,FunctionBase<SimpleRWLock *,&SimpleRWLock::AcquireReadLock,&SimpleRWLock::ReleaseReadLock>,0,&CompareDefault<SimpleRWLock *> >::Acquire+0x5 [D:\a\_work\1\s\src\coreclr\inc\holder.h @ 283] 
0d (Inline Function) --------`-------- coreclr!BaseHolder<SimpleRWLock *,FunctionBase<SimpleRWLock *,&SimpleRWLock::AcquireReadLock,&SimpleRWLock::ReleaseReadLock>,0,&CompareDefault<SimpleRWLock *> >::{ctor}+0x1e [D:\a\_work\1\s\src\coreclr\inc\holder.h @ 250] 
0e (Inline Function) --------`-------- coreclr!Holder<SimpleRWLock *,&SimpleRWLock::AcquireReadLock,&SimpleRWLock::ReleaseReadLock,0,&CompareDefault<SimpleRWLock *>,1>::{ctor}+0x1e [D:\a\_work\1\s\src\coreclr\inc\holder.h @ 746] 
0f 00000098`92b7b530 00007ff9`59cd5ee3 coreclr!LockedRangeList::IsInRangeWorker+0x3d [D:\a\_work\1\s\src\coreclr\vm\lockedrangelist.h @ 54] 
10 (Inline Function) --------`-------- coreclr!RangeList::IsInRange+0x13 [D:\a\_work\1\s\src\coreclr\inc\utilcode.h @ 3730] 
11 (Inline Function) --------`-------- coreclr!VirtualCallStubManager::isDispatchingStub+0x1a [D:\a\_work\1\s\src\coreclr\vm\virtualcallstub.h @ 382] 
12 00000098`92b7b580 00007ff9`59df98c6 coreclr!VirtualCallStubManager::getStubKind+0x103 [D:\a\_work\1\s\src\coreclr\vm\virtualcallstub.h @ 357] 
13 00000098`92b7b5b0 00007ff9`5a205223 coreclr!VirtualCallStubManager::FindStubManager+0x116 [D:\a\_work\1\s\src\coreclr\vm\virtualcallstub.cpp @ 987] 
14 00000098`92b7b680 00007ff9`59c3a4bf coreclr!AdjustContextForVirtualStub+0x53 [D:\a\_work\1\s\src\coreclr\vm\amd64\excepamd64.cpp @ 610] 
15 00000098`92b7b6b0 00007ff9`59c39f81 coreclr!CLRVectoredExceptionHandlerPhase3+0x2cf [D:\a\_work\1\s\src\coreclr\vm\excep.cpp @ 7524] 
16 00000098`92b7bdf0 00007ff9`59c39ebc coreclr!CLRVectoredExceptionHandlerPhase2+0x91 [D:\a\_work\1\s\src\coreclr\vm\excep.cpp @ 7307] 
17 00000098`92b7bee0 00007ff9`59c3a93e coreclr!CLRVectoredExceptionHandler+0xcfc [D:\a\_work\1\s\src\coreclr\vm\excep.cpp @ 7273] 
18 00000098`92b7c470 00007ff9`8b886b40 coreclr!CLRVectoredExceptionHandlerShim+0x1ae [D:\a\_work\1\s\src\coreclr\vm\excep.cpp @ 7999] 
19 00000098`92b7c4e0 00007ff9`8b8546cb ntdll!RtlInitializeCriticalSection+0x190
1a 00000098`92b7c580 00007ff9`8b8c988a ntdll!RtlImageNtHeaderEx+0x17b
1b 00000098`92b7cc80 00007ff9`5a25849b ntdll!KiUserExceptionDispatcher+0x3a
1c (Inline Function) --------`-------- coreclr!WKS::gc_heap::find_segment+0x11 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 22836] 
1d 00000098`92b7d380 00007ff9`5a045a84 coreclr!WKS::GCHeap::GetGenerationWithRange+0x1b [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 44266] 
1e 00000098`92b7d3b0 00007ff9`58622ee1 coreclr!ProfToEEInterfaceImpl::GetObjectGeneration+0x5f4 [D:\a\_work\1\s\src\coreclr\vm\proftoeeinterfaceimpl.cpp @ 9018] 
1f 00000098`92b7d5e0 00007ff9`58622957 Profiler!DllGetClassObject+0x5d741
20 00000098`92b7d6f0 00007ff9`59ece388 Profiler!DllGetClassObject+0x5d1b7
21 00000098`92b7d820 00007ff9`5a0346f8 coreclr!EEToProfInterfaceImpl::GarbageCollectionFinished+0x358 [D:\a\_work\1\s\src\coreclr\vm\eetoprofinterfaceimpl.cpp @ 5903] 
22 (Inline Function) --------`-------- coreclr!GarbageCollectionFinishedHelper+0x5 [D:\a\_work\1\s\src\coreclr\inc\profilepriv.inl @ 1664] 
23 (Inline Function) --------`-------- coreclr!ProfControlBlock::DoProfilerCallbackHelper+0x2c [D:\a\_work\1\s\src\coreclr\inc\profilepriv.h @ 283] 
24 (Inline Function) --------`-------- coreclr!ProfControlBlock::DoOneProfilerIteration+0x55 [D:\a\_work\1\s\src\coreclr\inc\profilepriv.h @ 199] 
25 (Inline Function) --------`-------- coreclr!ProfControlBlock::IterateProfilers+0x55 [D:\a\_work\1\s\src\coreclr\inc\profilepriv.h @ 207] 
26 (Inline Function) --------`-------- coreclr!ProfControlBlock::DoProfilerCallback+0x55 [D:\a\_work\1\s\src\coreclr\inc\profilepriv.h @ 295] 
27 (Inline Function) --------`-------- coreclr!ProfControlBlock::GarbageCollectionFinished+0x55 [D:\a\_work\1\s\src\coreclr\inc\profilepriv.inl @ 1671] 
28 00000098`92b7d9a0 00007ff9`5a26c1ff coreclr!GarbageCollectionFinishedCallback+0x138 [D:\a\_work\1\s\src\coreclr\vm\proftoeeinterfaceimpl.cpp @ 699] 
29 00000098`92b7da80 00007ff9`5a27013f coreclr!WKS::gc_heap::do_post_gc+0x5f [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 45599] 
2a 00000098`92b7db20 00007ff9`5a26f494 coreclr!WKS::gc_heap::gc1+0xc4f [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 21090] 
2b 00000098`92b7db90 00007ff9`5a2581ee coreclr!WKS::gc_heap::garbage_collect+0x724 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 22351] 
2c 00000098`92b7dc30 00007ff9`5a257d4e coreclr!WKS::GCHeap::GarbageCollectGeneration+0x42e [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 45922] 
2d (Inline Function) --------`-------- coreclr!WKS::GCHeap::GarbageCollectTry+0x60 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 45166] 
2e 00000098`92b7dc90 00007ff9`59e80292 coreclr!WKS::GCHeap::GarbageCollect+0x1ee [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 45103] 
2f 00000098`92b7dce0 00007ff8`fa9a143f coreclr!GCInterface_Collect+0x182 [D:\a\_work\1\s\src\coreclr\vm\comutilnative.cpp @ 1007] 
30 00000098`92b7de60 000001ef`e940d378 0x00007ff8`fa9a143f
31 00000098`92b7de68 000001ef`e47c15b0 0x000001ef`e940d378
32 00000098`92b7de70 00000098`92b7de90 0x000001ef`e47c15b0
33 00000098`92b7de78 000001ef`eb800020 0x00000098`92b7de90
34 00000098`92b7de80 00000098`92b7e1f0 0x000001ef`eb800020
35 00000098`92b7de88 9abcdef0`12345678 0x00000098`92b7e1f0
36 00000098`92b7de90 00007ff9`5a64bb58 0x9abcdef0`12345678
37 00000098`92b7de98 ffffffff`ffffffff coreclr!InlinedCallFrame::`vftable'
38 00000098`92b7dea0 00007ff8`fad049b8 0xffffffff`ffffffff
39 00000098`92b7dea8 00000000`00000000 0x00007ff8`fad049b8

The frame 0x1c is attempting to access memory at rax+0x60, which lies in an unmapped memory

0:000> u 00007ff9`5a258493
coreclr!WKS::gc_heap::find_segment+0x9 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 44264] [inlined in coreclr!WKS::GCHeap::GetGenerationWithRange+0x13 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 44264]]:
00007ff9`5a258493 e8e8e30200      call    coreclr!WKS::seg_mapping_table_segment_of (00007ff9`5a286880)
00007ff9`5a258498 488bd0          mov     rdx,rax
00007ff9`5a25849b 0fb64060        movzx   eax,byte ptr [rax+60h]
00007ff9`5a25849f 83f802          cmp     eax,2
00007ff9`5a2584a2 7527            jne     coreclr!WKS::GCHeap::GetGenerationWithRange+0x4b (00007ff9`5a2584cb)
00007ff9`5a2584a4 4c8b5228        mov     r10,qword ptr [rdx+28h]
00007ff9`5a2584a8 410fb6ca        movzx   ecx,r10b
00007ff9`5a2584ac c0e903          shr     cl,3

0:000> .frame /r 0x1c
1c (Inline Function) --------`-------- coreclr!WKS::gc_heap::find_segment+0x11 [D:\a\_work\1\s\src\coreclr\gc\gc.cpp @ 22836] 
rax=00007ff900000000 rbx=0000009892b7d5f8 rcx=00000000000003ff
rdx=00000000000000b1 rsi=00007ff95a620190 rdi=0000009892b7d408
rip=00007ff95a25849b rsp=0000009892b7d380 rbp=0000009892b7d4b0
 r8=00000098000019f8  r9=0000000000000010 r10=0000000292b7d6a0
r11=000002307b580000 r12=0000000000000088 r13=000001efeb8296a0
r14=0000009892b7d648 r15=0000000000000088
iopl=0         nv up ei pl zr na po nc
cs=0033  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000244
coreclr!WKS::gc_heap::find_segment+0x11:
00007ff9`5a25849b 0fb64060        movzx   eax,byte ptr [rax+60h] ds:00007ff9`00000060=??
0:000> db 00007ff900000000 
00007ff9`00000000  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
00007ff9`00000010  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
00007ff9`00000020  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
00007ff9`00000030  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
00007ff9`00000040  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
00007ff9`00000050  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
00007ff9`00000060  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????
00007ff9`00000070  ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ??  ????????????????

@janvorli janvorli added area-GC-coreclr and removed area-VM-coreclr untriaged New issue has not been triaged by the area owner labels Apr 6, 2022
@ghost
Copy link

ghost commented Apr 6, 2022

Tagging subscribers to this area: @dotnet/gc
See info in area-owners.md if you want to be subscribed.

Issue Details
      Assert failure(PID 776 [0x00000308], Thread: 2580 [0x0a14]): CONTRACT VIOLATION by SimpleRWLock::TryEnterRead at "D:\a\_work\1\s\src\coreclr\vm\simplerwlock.cpp" @ 27
      
      CAN_TAKE_LOCK called in a CANNOT_TAKE_LOCK region.
      
                              CONTRACT in VirtualCallStubManager::FindStubManager at "D:\a\_work\1\s\src\coreclr\vm\virtualcallstub.cpp" @ 969
                              GCX_NOTRIGGER in CLRVectoredExceptionHandlerPhase3 at "D:\a\_work\1\s\src\coreclr\vm\excep.cpp" @ 7489
      VIOLATED-->  CONTRACT in ProfToEEInterfaceImpl::GetObjectGeneration at "D:\a\_work\1\s\src\coreclr\vm\proftoeeinterfaceimpl.cpp" @ 9000
                              CONTRACT in EEToProfInterfaceImpl::GarbageCollectionFinished at "D:\a\_work\1\s\src\coreclr\vm\eetoprofinterfaceimpl.cpp" @ 5889
                              CONTRACT in GarbageCollectionFinishedCallback at "D:\a\_work\1\s\src\coreclr\vm\proftoeeinterfaceimpl.cpp" @ 693
                              GCX_COOP in GCInterface_Collect at "D:\a\_work\1\s\src\coreclr\vm\comutilnative.cpp" @ 1006
                              CONTRACT in GCInterface_Collect at "D:\a\_work\1\s\src\coreclr\vm\comutilnative.cpp" @ 997
                              CONTRACT in MethodDescCallSite::CallTargetWorker at "D:\a\_work\1\s\src\coreclr\vm\callhelpers.cpp" @ 280
                              GCX_COOP in Assembly::ExecuteMainMethod at "D:\a\_work\1\s\src\coreclr\vm\assembly.cpp" @ 1570
                              CONTRACT in Assembly::ExecuteMainMethod at "D:\a\_work\1\s\src\coreclr\vm\assembly.cpp" @ 1554
                              GCX_COOP in CorHost2::ExecuteAssembly at "D:\a\_work\1\s\src\coreclr\vm\corhost.cpp" @ 357
                              CONTRACT in CorHost2::ExecuteAssembly at "D:\a\_work\1\s\src\coreclr\vm\corhost.cpp" @ 306
      
      
      
      CORECLR! CONTRACT_ASSERT + 0x307 (0x00007ff9`59b12ef7)
      CORECLR! ClrDebugState::LockTaken + 0x76 (0x00007ff9`59c008a6)
      CORECLR! SimpleRWLock::TryEnterRead + 0xB0 (0x00007ff9`5a0817e0)
      CORECLR! SimpleRWLock::EnterRead + 0xA2 (0x00007ff9`5a0812b2)
      CORECLR! LockedRangeList::IsInRangeWorker + 0x3D (0x00007ff9`59b270ad)
      CORECLR! VirtualCallStubManager::getStubKind + 0x103 (0x00007ff9`59cd5ee3)
      CORECLR! VirtualCallStubManager::FindStubManager + 0x116 (0x00007ff9`59df98c6)
      CORECLR! AdjustContextForVirtualStub + 0x53 (0x00007ff9`5a205223)
      CORECLR! CLRVectoredExceptionHandlerPhase3 + 0x2CF (0x00007ff9`59c3a4bf)
      CORECLR! CLRVectoredExceptionHandlerPhase2 + 0x91 (0x00007ff9`59c39f81)
          File: D:\a\_work\1\s\src\coreclr\vm\simplerwlock.cpp Line: 27
          Image: C:\h\w\BACC0A33\p\CoreRun.exe

In https://helixre8s23ayyeko0k025g8.blob.core.windows.net/dotnet-runtime-refs-pull-67599-merge-26eaddf607184fe28a/profiler.gc/1/console.82d7f3ce.log?sv=2019-07-07&se=2022-04-25T18%3A57%3A26Z&sr=c&sp=rl&sig=wd65GZnAyydb6efKQdfc0TtHGmIGeTWwgyU5S255L9M%3D

Author: jkoritzinsky
Assignees: -
Labels:

area-GC-coreclr

Milestone: -

@jkotas
Copy link
Member

jkotas commented Apr 10, 2022

Failed again in #67823

@jkotas jkotas added the blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' label Apr 10, 2022
@mangod9
Copy link
Member

mangod9 commented Apr 26, 2022

@cshung anything which has been recently fixed for this?

@cshung
Copy link
Member

cshung commented Apr 26, 2022

@cshung anything which has been recently fixed for this?

I did some investigation of this but I haven't nailed the root cause yet.

One thing for sure is that the pointers returned by the second parameter of the ICorProfilerCallback4::ObjectReferences() could be a bad pointer when the bug repros, but beyond that I am not able to reproduce that locally yet to figure out why.

In a typical scenario, I confirm that the object reported by this API matches exactly with what !DumpHeap would return, pointer to pointer matches completely.

@VincentBu
Copy link

Failed again in: runtime-coreclr jitstress-isas-x86 20220521.1

Failed test:

coreclr windows x64 Checked jitstress_isas_x86_nosse41 @ Windows.10.Amd64.Open

- profiler\\gc\\gc\\gc.cmd

Error message:

Assert failure(PID 1640 [0x00000668], Thread: 9284 [0x2444]): CONTRACT VIOLATION by SimpleRWLock::TryEnterRead at "D:\a_work\1\s\src\coreclr\vm\simplerwlock.cpp" @ 27

CAN_TAKE_LOCK called in a CANNOT_TAKE_LOCK region.

                    CONTRACT in VirtualCallStubManager::FindStubManager at "D:\a\_work\1\s\src\coreclr\vm\virtualcallstub.cpp" @ 969
                    GCX_NOTRIGGER in CLRVectoredExceptionHandlerPhase3 at "D:\a\_work\1\s\src\coreclr\vm\excep.cpp" @ 7489
VIOLATED-->  CONTRACT in ProfToEEInterfaceImpl::GetObjectGeneration at "D:\a_work\1\s\src\coreclr\vm\proftoeeinterfaceimpl.cpp" @ 9000
CONTRACT in EEToProfInterfaceImpl::GarbageCollectionFinished at "D:\a_work\1\s\src\coreclr\vm\eetoprofinterfaceimpl.cpp" @ 5889
CONTRACT in GarbageCollectionFinishedCallback at "D:\a_work\1\s\src\coreclr\vm\proftoeeinterfaceimpl.cpp" @ 693
GCX_COOP in GCInterface_Collect at "D:\a_work\1\s\src\coreclr\vm\comutilnative.cpp" @ 1016
CONTRACT in GCInterface_Collect at "D:\a_work\1\s\src\coreclr\vm\comutilnative.cpp" @ 1007
CONTRACT in MethodDescCallSite::CallTargetWorker at "D:\a_work\1\s\src\coreclr\vm\callhelpers.cpp" @ 280
GCX_COOP in Assembly::ExecuteMainMethod at "D:\a_work\1\s\src\coreclr\vm\assembly.cpp" @ 1514
CONTRACT in Assembly::ExecuteMainMethod at "D:\a_work\1\s\src\coreclr\vm\assembly.cpp" @ 1498
GCX_COOP in CorHost2::ExecuteAssembly at "D:\a_work\1\s\src\coreclr\vm\corhost.cpp" @ 357
CONTRACT in CorHost2::ExecuteAssembly at "D:\a_work\1\s\src\coreclr\vm\corhost.cpp" @ 306

CORECLR! CONTRACT_ASSERT + 0x320 (0x00007ffe29c03690) CORECLR! ClrDebugState::LockTaken + 0x76 (0x00007ffe29cf7c96)
CORECLR! SimpleRWLock::TryEnterRead + 0xB0 (0x00007ffe2a191910) CORECLR! SimpleRWLock::EnterRead + 0xA2 (0x00007ffe2a1913f2)
CORECLR! LockedRangeList::IsInRangeWorker + 0x3D (0x00007ffe29c1833d) CORECLR! VirtualCallStubManager::getStubKind + 0x60 (0x00007ffe29dd4440)
CORECLR! VirtualCallStubManager::FindStubManager + 0x116 (0x00007ffe29f0a4a6) CORECLR! AdjustContextForVirtualStub + 0x53 (0x00007ffe2a31f023)
CORECLR! CLRVectoredExceptionHandlerPhase3 + 0x2CF (0x00007ffe29d31bbf) CORECLR! CLRVectoredExceptionHandlerPhase2 + 0x91 (0x00007ffe29d31681)
File: D:\a_work\1\s\src\coreclr\vm\simplerwlock.cpp Line: 27
Image: C:\h\w\AC01096A\p\CoreRun.exe

Unhandled exception. System.Exception: Profiler tests are expected to contain the text 'PROFILER TEST PASSES' in the console output of the profilee app to indicate a passing test. Usually it is printed from the Shutdown() method of the profiler implementation. This text was not found in the output above.
at Profiler.Tests.ProfilerTestRunner.FailFastWithMessage(String error)
at Profiler.Tests.ProfilerTestRunner.Run(String profileePath, String testName, Guid profilerClsid, String profileeArguments, ProfileeOptions profileeOptions, Dictionary`2 envVars, String reverseServerName, Boolean loadAsNotification, Int32 notificationCopies)
at Profiler.Tests.GCTests.Main(String[] args)

Return code:      1
Raw output file:      C:\h\w\AC01096A\w\A56E08A9\uploads\Reports\profiler.gc\gc\gc.output.txt
Raw output:
BEGIN EXECUTION
"C:\h\w\AC01096A\p\corerun.exe" -p "System.Reflection.Metadata.MetadataUpdater.IsSupported=false"  gc.dll
Profiler path: C:\h\w\AC01096A\w\A56E08A9\e\profiler\gc\gc\Profiler.dll
Profiler.dll!DllGetClassObject
Profiler.dll!Profiler::Initialize
Did 0 iterations Allocated=69032
Did 1000 iterations Allocated=521312
Did 2000 iterations Allocated=969408
Did 3000 iterations Allocated=1417504
Did 4000 iterations Allocated=1865600

Test failed: Profiler tests are expected to contain the text 'PROFILER TEST PASSES' in the console output of the profilee app to indicate a passing tes


Stack trace
   at profiler_gc._gc_gc_._gc_gc_cmd()

@BruceForstall BruceForstall added the blocking-clean-ci-optional Blocking optional rolling runs label Jun 7, 2022
@ghost ghost added the in-pr There is an active PR which will close this issue when it is merged label Jun 18, 2022
@ghost ghost removed the in-pr There is an active PR which will close this issue when it is merged label Jun 20, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Jul 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-GC-coreclr blocking-clean-ci Blocking PR or rolling runs of 'runtime' or 'runtime-extra-platforms' blocking-clean-ci-optional Blocking optional rolling runs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants