dotnet / corert

This repo contains CoreRT, an experimental .NET Core runtime optimized for AOT (ahead of time compilation) scenarios, with the accompanying compiler toolchain.
http://dot.net
MIT License
2.91k stars 511 forks source link

Access violation in GC thread #6787

Open RustyCZ opened 5 years ago

RustyCZ commented 5 years ago

I have tried Microsoft.DotNet.ILCompiler in version 1.0.0-alpha-27221-02 and I have encountered an error Access violation reading location 0x0000000000000000 in garbage collector thread. I am using Span of structures which have explicit layout and size if it may be of any help. It was compiled for win-x64 netcoreapp2.1.

Exception thrown at 0x00007FF7325F5870 in Test.exe: 0xC0000005: Access violation reading location 0x0000000000000000.

[Inline Frame] Test.exe!WKS::my_get_size [Inline Frame] Test.exe!WKS::my_get_size(Object ) Line 8905 Test.exe!WKS::gc_heap::mark_object_simple1(unsigned char oo, unsigned char start) Line 17649 Test.exe!WKS::gc_heap::mark_object_simple(unsigned char po) Line 18182 Test.exe!WKS::GCHeap::Promote(Object ppObject, ScanContext sc, unsigned int flags) Line 33839 Test.exe!ScanConsecutiveHandlesWithoutUserData(Object pValue, Object pLast, ScanCallbackInfo pInfo, unsigned __int64 formal) Line 452 [Inline Frame] Test.exe!BlockScanBlocksEphemeralWorker(unsigned int dwClumpMask, unsigned int) Line 685 Test.exe!BlockScanBlocksEphemeral(TableSegment pSegment, unsigned int uBlock, unsigned int uCount, ScanCallbackInfo pInfo) Line 742 [Inline Frame] Test.exe!SegmentScanByTypeMap(TableSegment ) Line 1698 Test.exe!TableScanHandles(HandleTable pTable, const unsigned int puType, unsigned int uTypeCount, TableSegment ()(HandleTable , TableSegment , CrstHolderWithState ) pfnSegmentIterator, void()(TableSegment , unsigned int, unsigned int, ScanCallbackInfo ) pfnBlockHandler, ScanCallbackInfo pInfo, CrstHolderWithState pCrstHolder) Line 1756 Test.exe!HndScanHandlesForGC(HandleTable hTable, void()(Object , unsigned int64 , unsigned int64, unsigned int64) scanProc, unsigned int64 param1, unsigned int64 param2, const unsigned int types, unsigned int typeCount, unsigned int condemned, unsigned int maxgen, unsigned int flags) Line 1044 Test.exe!Ref_TraceNormalRoots(unsigned int condemned, unsigned int maxgen, ScanContext sc, void()(Object , ScanContext , unsigned int) fn) Line 1144 Test.exe!GCScan::GcScanHandles(void()(Object , ScanContext , unsigned int) fn, int condemned, int max_gen, ScanContext sc) Line 187 Test.exe!WKS::gc_heap::mark_phase(int condemned_gen_number, unsigned int mark_only_p) Line 19638 Test.exe!WKS::gc_heap::gc1() Line 15272 Test.exe!WKS::gc_heap::garbage_collect(int n) Line 16864 Test.exe!WKS::GCHeap::GarbageCollectGeneration(unsigned int gen, gc_reason reason) Line 35231 Test.exe!WKS::gc_heap::try_allocate_more_space(alloc_context acontext, unsigned __int64 size, int gen_number) Line 13083 [Inline Frame] Test.exe!WKS::gc_heap::allocate_more_space(alloc_context ) Line 13370 [Inline Frame] Test.exe!WKS::gc_heap::allocate(unsigned int64) Line 13401 Test.exe!WKS::GCHeap::Alloc(gc_alloc_context * context, unsigned int64 size, unsigned int flags) Line 34542 Test.exe!RhpNewObject() Line 76 [External Code]

MichalStrehovsky commented 5 years ago

@RustyCZ do you happen to have a small piece of code that reproduces this?

RustyCZ commented 5 years ago

@MichalStrehovsky unfortunately it is part of the larger code base which I cannot share and I have not been able to isolate it to a smaller sample so far.