Skip to content

Hang during 'ComWrappers.TryGetOrCreateObjectForComInstanceInternal()' on Native AOT #110823

@Sergio0694

Description

@Sergio0694

Description

Note

Somewhat related to #109538. I got this hang from a .NET 10 build with the fix for that issue already there.

Description

I hit another hang on Native AOT when testing the Microsoft Store:

Stack trace (click to expand):
combase.dll!MTAThreadWaitForCall(CSyncClientCall * pClientCall, WaitForCallReason reason, unsigned long dwRetryTimeout) Line 7139 C++ combase.dll!MTAThreadDispatchCrossApartmentCall(tagRPCOLEMESSAGE * pMessage, OXIDEntry * pOXIDEntry, CSyncClientCall * pClientCall) Line 234 C++ [Inline Frame] combase.dll!CSyncClientCall::SwitchAptAndDispatchCall(tagRPCOLEMESSAGE * pMessage) Line 5691 C++ combase.dll!CSyncClientCall::SendReceive2(tagRPCOLEMESSAGE * pMessage, unsigned long * pstatus) Line 5297 C++ [Inline Frame] combase.dll!SyncClientCallRetryContext::SendReceiveWithRetry(tagRPCOLEMESSAGE *) Line 1494 C++ [Inline Frame] combase.dll!CSyncClientCall::SendReceiveInRetryContext(SyncClientCallRetryContext *) Line 582 C++ combase.dll!DefaultSendReceive(CSyncClientCall * pClientCall, tagRPCOLEMESSAGE * pMsg, unsigned long * pulStatus) Line 540 C++ combase.dll!CSyncClientCall::SendReceive(tagRPCOLEMESSAGE * pMessage, unsigned long * pulStatus) Line 788 C++ combase.dll!CClientChannel::SendReceive(tagRPCOLEMESSAGE * pMessage, unsigned long * pulStatus) Line 660 C++ combase.dll!NdrExtpProxySendReceive(void * pThis, _MIDL_STUB_MESSAGE * pStubMsg) Line 1989 C++ rpcrt4.dll!00007ffc9cc7050e() Unknown combase.dll!ObjectStublessClient(void * ParamAddress, __int64 * FloatRegisters, long Method) Line 366 C++ combase.dll!ObjectStubless() Line 176 Unknown combase.dll!CStdMarshal::Begin_RemQIAndUnmarshal1(unsigned short cIIDs, _GUID * pIIDs, tagQICONTEXT * pQIC) Line 6025 C++ [Inline Frame] combase.dll!CStdMarshal::Begin_RemQIAndUnmarshal(unsigned short) Line 5914 C++ [Inline Frame] combase.dll!CStdMarshal::Begin_QueryRemoteInterfaces(unsigned short) Line 5793 C++ combase.dll!CStdMarshal::QueryRemoteInterfaces(unsigned short cIIDs, _GUID * pIIDs, tagSQIResult * pQIRes) Line 5759 C++ [Inline Frame] combase.dll!CStdIdentity::CInternalUnk::QueryMultipleInterfaces(unsigned long) Line 753 C++ combase.dll!CStdIdentity::CInternalUnk::QueryInterface(const _GUID & riid, void * * ppv) Line 428 C++ <MICROSOFT_STORE>.exe!S_P_CoreLib_System_Runtime_InteropServices_ComWrappers_NativeObjectWrapper__Create() Line 514 Unknown > <MICROSOFT_STORE>.exe!S_P_CoreLib_System_Runtime_InteropServices_ComWrappers__TryGetOrCreateObjectForComInstanceInternal() Line 1064 Unknown <MICROSOFT_STORE>.exe!S_P_CoreLib_System_Runtime_InteropServices_ComWrappers__GetOrCreateObjectForComInstance() Line 799 Unknown <MICROSOFT_STORE>.exe!WinRT_Runtime_WinRT_ComWrappersSupport__CreateRcwForComObject_0<System___Canon>() Unknown <MICROSOFT_STORE>.exe!WinRT_Runtime_WinRT_MarshalInspectable_1<System___Canon>__FromAbi() Unknown <MICROSOFT_STORE>.exe!Microsoft_Windows_SDK_NET_WinRT_GenericTypeInstantiations_Windows_Foundation_AsyncOperationCompletedHandler_1_Windows_Graphics_Imaging_PixelDataProvider__Do_Abi_Invoke() Unknown 

Dump shared internally, opening this just for tracking (same as #110747).

From @MichalStrehovsky:

"This thing here acquires a lock and then NativeObjectWrapper.Create goes on to call QueryInterface on who-knows-what that acquires some lock. We then have several threads waiting for this global ComWrappers._lock lock that is never released because we’re blocked inside the QueryInterface. CoreCLR uses a different locking strategy and NativeObjectWrapper.Create doesn’t seem to be running under a lock from what I see."

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    Status

    No status

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      close