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

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

Open
Sergio0694 opened this issue Dec 18, 2024 · 3 comments · May be fixed by #110828
Open

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

Sergio0694 opened this issue Dec 18, 2024 · 3 comments · May be fixed by #110828
Labels
area-NativeAOT-coreclr area-System.Runtime.InteropServices in-pr There is an active PR which will close this issue when it is merged partner-impact This issue impacts a partner who needs to be kept updated untriaged New issue has not been triaged by the area owner

Comments

@Sergio0694
Copy link
Contributor

Sergio0694 commented Dec 18, 2024

Description

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."

@Sergio0694 Sergio0694 added area-NativeAOT-coreclr area-System.Runtime.InteropServices partner-impact This issue impacts a partner who needs to be kept updated labels Dec 18, 2024
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Dec 18, 2024
Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

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

1 similar comment

This comment has been minimized.

@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-NativeAOT-coreclr area-System.Runtime.InteropServices in-pr There is an active PR which will close this issue when it is merged partner-impact This issue impacts a partner who needs to be kept updated untriaged New issue has not been triaged by the area owner
Projects
Status: No status
1 participant