-
Notifications
You must be signed in to change notification settings - Fork 5.2k
Description
The cDAC SOS tests have intermittently been failing due to non-deterministic destruction of COM objects. SOS releases then immediately frees the DAC library. The was okay with a native COM implementation as the objects are freed as soon as the ref count hits 0. However, this behavior is problematic with a managed COM implementation. The source generated COM implementation used in the cDAC only releases its held references on finalization. While it would be theoretically possible to shim the COM Release
call to deterministically release held resources, the manage object would still not be freed deterministically and therefore would cause a memory leak.
Currently we occasionally see the following error in test runs. This is caused by a race condition between the GC and SOS unloading the DAC. The cDAC tries to release its handle to the DAC after the DAC is unloaded leading to an AV.
STDERROR: 00:01.961: at System.RuntimeExceptionHelpers.FailFast(String, Exception, String, RhFailFastReason, IntPtr, IntPtr) + 0x2b7
STDERROR: 00:01.961: at System.RuntimeExceptionHelpers.GetRuntimeException(ExceptionIDs) + 0x231
STDERROR: 00:01.962: at System.Runtime.EH.GetClasslibException(ExceptionIDs, IntPtr) + 0x5d
STDERROR: 00:01.962: at System.Runtime.InteropServices.Marshal.Release(IntPtr) + 0x46
STDERROR: 00:01.962: at System.Runtime.InteropServices.Marshalling.FreeThreadedStrategy.System.Runtime.InteropServices.Marshalling.IIUnknownStrategy.Release(Void*) + 0x1c
STDERROR: 00:01.962: at System.Runtime.InteropServices.Marshalling.DefaultCaching.System.Runtime.InteropServices.Marshalling.IIUnknownCacheStrategy.Clear(IIUnknownStrategy) + 0xf8
STDERROR: 00:01.962: at System.Runtime.InteropServices.Marshalling.ComObject.Finalize() + 0x59
STDERROR: 00:01.962: at System.Runtime.__Finalizer.DrainQueue() + 0x8e
STDERROR: 00:01.962: at System.Runtime.__Finalizer.ProcessFinalizers() + 0x42
Furthermore, NativeAOT DLLs do not support unloading at all. In order to support the cDAC SOS should stop unloading the DAC/cDAC libraries between stop points.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status