c++ - Thread freezes while calling AccessibleChildren -
every , again c++ application walk msaa tree ofmultiple applications using code based on msdn example page: https://msdn.microsoft.com/en-us/library/windows/desktop/dd317975(v=vs.85).aspx
it worked perfectly, until few months ago when started noticing thread freezes on accessiblechildren call.
here know of it:
- this not occur often
- it happens when walking trees of different applications.
- it not connected amount of children of current node debugged minidumps of bottom call
childcount
equeal 1. - it happens on different pcs.
- thread in such position never wake up. once freeze happens thread stay in state until app restarted.
- sometimes thread dies during such iterations , in such cases not able catch stacktrace of it. rest of app keeps running then, dumps shows given thread not work anymore although it's task infinite loop sleeps. presume connected freezes. somehow.
my question is: can point out reasons of such freeze , how prevent them? if not there way move recursion thread, safely "timed out" thread?
this example stack trace of such events, top nested call. removed recursion here shorten reading bit.
--> ntdll.dll!_ntwaitformultipleobjects@20() unknown ntdll.dll!_ntwaitformultipleobjects@20() unknown kernelbase.dll!_waitformultipleobjectsex@20() unknown kernel32.dll!_waitformultipleobjectseximplementation@20() unknown user32.dll!_realmsgwaitformultipleobjectsex@20() unknown ole32.dll!cclimodalloop::blockfn(void * * ahevent, unsigned long cevents, unsigned long * lpdwsignaled) line 1222 c++ ole32.dll!modalloop(cmessagecall * pcall) line 211 c++ ole32.dll!threadsendreceive(cmessagecall * pcall) line 4979 c++ ole32.dll!crpcchannelbuffer::switchaptanddispatchcall(cmessagecall * * ppcall) line 4454 c++ ole32.dll!crpcchannelbuffer::sendreceive2(tagrpcolemessage * pmessage, unsigned long * pstatus) line 4076 c++ ole32.dll!cclimodalloop::sendreceive(tagrpcolemessage * pmsg, unsigned long * pulstatus, iinternalchannelbuffer * pchnl) line 899 c++ ole32.dll!captrpcchnl::sendreceive(tagrpcolemessage * pmsg, unsigned long * pulstatus) line 583 c++ ole32.dll!cctxcomchnl::sendreceive(tagrpcolemessage * pmessage, unsigned long * pulstatus) line 659 c++ ole32.dll!ndrextpproxysendreceive(void * pthis, _midl_stub_message * pstubmsg) line 1932 c++ rpcrt4.dll!@ndrpproxysendreceive@4() unknown rpcrt4.dll!_ndrclientcall2() unknown ole32.dll!objectstublessclient(void * paramaddress, long method) line 474 c++ ole32.dll!_objectstubless@0() line 154 unknown ole32.dll!cstdmarshal::begin_remqiandunmarshal1(unsigned short ciids, _guid * piids, tagqicontext * pqic) line 4551 c++ ole32.dll!cstdmarshal::begin_queryremoteinterfaces(unsigned short ciids, _guid * piids, tagqicontext * pqic) c++ ole32.dll!cstdmarshal::queryremoteinterfaces(unsigned short ciids, _guid * piids, tagsqiresult * pqires) line 4284 c++ ole32.dll!cstdidentity::cinternalunk::querymultipleinterfaces(unsigned long cmqis, tagmulti_qi * pmqis) line 596 c++ ole32.dll!cstdidentity::cinternalunk::queryinterface(const _guid & riid, void * * ppv) line 352 c++ ole32.dll!iunknown_queryinterface_proxy(iunknown * this, const _guid & riid, void * * ppv) line 1723 c++ ole32.dll!counmarshalinterface(istream * pstm, const _guid & riid, void * * ppv) line 996 c++ oleacc.dll!unmarshalinterface(unsigned char const *,unsigned long,struct _guid const &,void * *) unknown oleacc.dll!freeupslot(struct outstandingobjectentry *) unknown oleacc.dll!_objectfromlresult@16() unknown oleacc.dll!nativeiaccessiblefromwindow(struct hwnd__ *,unsigned long,struct _guid const &,void * *) unknown oleacc.dll!_original_accessibleobjectfromwindow@16() unknown oleacc.dll!_accessibleobjectfromwindow@16() unknown oleacc.dll!getwindowobject(struct hwnd__ *,struct tagvariant *) unknown oleacc.dll!cclient::next(unsigned long,struct tagvariant *,unsigned long *) unknown oleacc.dll!accwrap_base::next(unsigned long,struct tagvariant *,unsigned long *) unknown oleacc.dll!_accessiblechildren@20() unknown //my recursion ends here
i still don't know why above happening , how protect application against within code. solution i've thought myself use separate process , wait timeout. this microsoft example, timeout set constant value (like half second) rather infinite
.
if waiting ends because of process finished i'd it's stdout response (some json result or that). if process times out terminate clean resources.
not perfect solution, give me control on happening , somehow protected against memory leaks etc.
since half measure happily accept other ideas solve problems.
Comments
Post a Comment