Search code examples
c++windowswebrtcfreezewasapi

App hangs on RPC


I've an app using webrtc/coreaudio for media and it very rarely hangs on one PC.

WinDBG's !analyze -v -hang gives the following:

DEFAULT_BUCKET_ID:  APPLICATION_HANG_BlockedOn_RPC
PRIMARY_PROBLEM_CLASS:  APPLICATION_HANG_BlockedOn_RPC
BUCKET_ID:  HANG_audioses!AudioServerDestroyStream+19
FAILURE_BUCKET_ID:APPLICATION_HANG_BlockedOn_RPC_cfffffff_AudioSes.dll!AudioServerDestroyStream
ANALYSIS_SOURCE:  UM
FAILURE_ID_HASH_STRING:um:application_hang_blockedon_rpc_cfffffff_audioses.dll!audioserverdestroystream

with such callstack:

ntdll!NtAlpcSendWaitReceivePort+0x12
rpcrt4!LRPC_CASSOCIATION::AlpcSendWaitReceivePort+0x5d
rpcrt4!LRPC_BASE_CCALL::DoSendReceive+0xa3
rpcrt4!LRPC_BASE_CCALL::SendReceive+0x2f
rpcrt4!LRPC_CCALL::SendReceive+0x25
rpcrt4!I_RpcSendReceive+0x28
rpcrt4!NdrSendReceive+0x31
rpcrt4!NdrpSendReceive+0x9
rpcrt4!NdrClientCall2+0x1a6
AudioSes!AudioServerDestroyStream+0x19
AudioSes!CAudioClient::DestroyRemoteStream+0x62
AudioSes!CAudioClient::FinalRelease+0xd8
AudioSes!ATL::CComObject<CAudioClient>::~CComObject<CAudioClient>+0x33
AudioSes!ATL::CComObject<CAudioClient>::`scalar deleting destructor'+0xd
AudioSes!ATL::CComObject<CAudioClient>::Release+0x27
AudioSes!CAudioRenderClient::FinalRelease+0x4c
AudioSes!ATL::CComObject<CAudioRenderClient>::~CComObject<CAudioRenderClient>+0x17
AudioSes!ATL::CComObject<CAudioRenderClient>::`scalar deleting destructor'+0xd
AudioSes!ATL::CComObject<CAudioRenderClient>::Release+0x27
IPTLibrary!webrtc::AudioDeviceWindowsCore::StopPlayout+0x226
IPTLibrary!webrtc::AudioDeviceModuleImpl::StopPlayout+0x2d

And here's my question: how can I know/locate what service is RPC-called from AudioSes!AudioServerDestroyStream? Thanks.


Solution

    1. set up kernel debugger
    2. find on the stack a handle of the client ALPC port
    3. find kernel address of the ALPC port !handle port_handle
    4. print info about port: !alpc port_address
    5. If you do all things right you will see address of the server process
    6. use !process command to print info abot process