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

Background threads are not terminating during _Extension.OnDisconnection #1716

Closed
comintern opened this issue Jun 6, 2016 · 3 comments
Closed
Labels
technical-debt This makes development harder or is leftover from a PullRequest. Needs to be adressed at some point.

Comments

@comintern
Copy link
Contributor

Discovered this when I was doing some testing on how COM objects get released in the GC, and confirmed while testing a putative fix for #1710. This is very likely the cause of some of the weird shutdown errors, i.e. #1710, #1633, #1533, and #1438 (might be more, that's just a quick scan). These appear to be reporting "random" exceptions when closing because the exception that gets thrown would depend on the what the background thread is doing when tries to access something that the main thread has already torn down.

@comintern
Copy link
Contributor Author

Stack trace (mainly so I don't have to catch and dump it again):

ole32.dll!CDestObjectWrapper::GetMarshalSizeMax(const _GUID & riid, void * pv, unsigned long dwDestCtx, void * pvDestObjectWrapper, unsigned long mshlflags, unsigned long * pSize) Line 493    C++
ole32.dll!CoGetMarshalSizeMax(unsigned long * pulSize, const _GUID & riid, IUnknown * pUnk, unsigned long dwDestCtx, void * pvDestCtx, unsigned long mshlflags) Line 722    C++
ole32.dll!CRemoteUnknown::DoCallback(tagXAptCallback * pCallbackData) Line 1571 C++
rpcrt4.dll!_Invoke@12() Unknown
rpcrt4.dll!_NdrStubCall2@16()   Unknown
ole32.dll!CStdStubBuffer_Invoke(IRpcStubBuffer * This, tagRPCOLEMESSAGE * prpcmsg, IRpcChannelBuffer * pRpcChannelBuffer) Line 1590 C++
ole32.dll!SyncStubInvoke(tagRPCOLEMESSAGE * pMsg, const _GUID & riid, CIDObject * pID, void * pVtableAddress, IRpcChannelBuffer * pChnl, IRpcStubBuffer * pStub, unsigned long * pdwFault) Line 1187    C++
ole32.dll!StubInvoke(tagRPCOLEMESSAGE * pMsg, CStdIdentity * pStdID, IRpcStubBuffer * pStub, IRpcChannelBuffer * pChnl, tagIPIDEntry * pIPIDEntry, unsigned long * pdwFault)    C++
ole32.dll!CCtxComChnl::ContextInvoke(tagRPCOLEMESSAGE * pMessage, IRpcStubBuffer * pStub, tagIPIDEntry * pIPIDEntry, unsigned long * pdwFault) Line 1262    C++
ole32.dll!MTAInvoke(tagRPCOLEMESSAGE * pMsg, unsigned long CallCatIn, IRpcStubBuffer * pStub, IInternalChannelBuffer * pChnl, tagIPIDEntry * pIPIDEntry, unsigned long * pdwFault) Line 2105    C++
ole32.dll!STAInvoke(tagRPCOLEMESSAGE * pMsg, unsigned long CallCatIn, IRpcStubBuffer * pStub, IInternalChannelBuffer * pChnl, void * pv, tagIPIDEntry * pIPIDEntry, unsigned long * pdwFault) Line 1924 C++
ole32.dll!AppInvoke(CMessageCall * pCall, CRpcChannelBuffer * pChannel, IRpcStubBuffer * pStub, void * pv, void * pStubBuffer, tagIPIDEntry * pIPIDEntry, LocalThis * pLocalb) Line 1081    C++
ole32.dll!ComInvokeWithLockAndIPID(CMessageCall * pCall, tagIPIDEntry * pIPIDEntry) Line 1724   C++
ole32.dll!ComInvoke(CMessageCall * pCall) Line 1469 C++
ole32.dll!ThreadDispatch(void * param) Line 298 C++
ole32.dll!ThreadWndProc(HWND__ * window, unsigned int message, unsigned int wparam, long params) Line 598   C++
user32.dll!_InternalCallWinProc@20()    Unknown
user32.dll!_UserCallWinProcCheckWow@32()    Unknown
user32.dll!_DispatchMessageWorker@8()   Unknown
user32.dll!_DispatchMessageW@4()    Unknown
ole32.dll!CCliModalLoop::PeekRPCAndDDEMessage() Line 1508   C++
ole32.dll!CCliModalLoop::FindMessage(unsigned long dwStatus) Line 1558  C++
ole32.dll!CCliModalLoop::HandleWakeForMsg() Line 1324   C++
ole32.dll!CCliModalLoop::BlockFn(void * * ahEvent, unsigned long cEvents, unsigned long * lpdwSignaled) C++
ole32.dll!CoWaitForMultipleHandles(unsigned long dwFlags, unsigned long dwTimeout, unsigned long cHandles, void * * pHandles, unsigned long * lpdwindex) Line 109   C++
mscoreei.dll!RuntimeDesc::ShutdownAllActiveRuntimes(unsigned int,class RuntimeDesc *,enum RuntimeDesc::ShutdownCompatMode)  Unknown
mscoreei.dll!_CorExitProcess@4()    Unknown
mscoree.dll!_ShellShim_CorExitProcess@4()   Unknown
msvcr100.dll!___crtCorExitProcess() Unknown
msvcr100.dll!___crtExitProcess()    Unknown
msvcr100.dll!__cinit()  Unknown
msvcr100.dll!_exit()    Unknown
EXCEL.EXE!0124934c()    Unknown
[Frames below may be incorrect and/or missing, no symbols loaded for EXCEL.EXE] 
[External Code] 

@retailcoder
Copy link
Member

@comintern was this fixed with #1780?

@comintern
Copy link
Contributor Author

This seems to have been fixed in the last couple days. Possibly by #1813?

@Vogel612 Vogel612 added technical-debt This makes development harder or is leftover from a PullRequest. Needs to be adressed at some point. and removed technical-debt This makes development harder or is leftover from a PullRequest. Needs to be adressed at some point. quality-control labels Nov 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
technical-debt This makes development harder or is leftover from a PullRequest. Needs to be adressed at some point.
Projects
None yet
Development

No branches or pull requests

4 participants