[coroutine] x86 msvc11 stack corruption
Hi, I use Boost 1.55 uni-directional coroutines to build an x86 MSVC11 application. I have a simple pull-type (boost::coroutines::coroutine<void>::pull_type) that under certain reproducable conditions destroys the stack after returning from the coroutine. Here is the corrupted stack as shown by VS2012
ebs2000.exe!CScriptMainFrame::DoRun(CPascalEditorDoc * 0x00000000, int 0x00000000, int 0x00000000) Line 3372 C++ ebs2000.exe!CScriptMainFrame::OnDebugStepover() Line 4916 C++ mfc110u.dll!_AfxDispatchCmdMsg(CCmdTarget *, unsigned int, int, void (void) *, void *, unsigned int, AFX_CMDHANDLERINFO *) C++ 00000002() Unknown [Frames below may be incorrect and/or missing] mfc110u.dll!CCmdTarget::OnCmdMsg(unsigned int, int 0x00000000, void *, AFX_CMDHANDLERINFO *) Line 364 C++ mfc110u.dll!CWnd::OnCommand(unsigned int 0x00018263, long 0x00000000) Line 2785 C++ mfc110u.dll!CFrameWnd::OnCommand(unsigned int 0x00018263, long 0x00000000) Line 389 C++ ...
This only happens in windows x86 32-bit release-builds when the coroutine
finishes upon a user-action that also includes a windows WM_SETFOCUS message
on my menu-bar.
If at least one of the following is true, the stack-corruption does NOT
happen:
- debug-build
- x64 build
- using a different pull-type, e.g.
enum status_enum{...};
boost::coroutines::coroutine
Hi, after having another crash in an external dll loaded from a Boost.Coroutine created stack, I came over the following posts: https://www.marshut.net/kswwzq/boost-context-cause-strange-crash-on-certan-w... and https://github.com/boostorg/coroutine/pull/18 After fixing an error in the Win32 Fiber/Coroutine implementation my code runs fine and neither the originally reported error nor the error in the external dll occurs anymore. +1 for including an alternative Win32-Fiber implementation in Boost.Coroutine Tobias -- View this message in context: http://boost.2283326.n4.nabble.com/coroutine-x86-msvc11-stack-corruption-tp4... Sent from the Boost - Dev mailing list archive at Nabble.com.
Here is another interesting fact about coroutines on windows: when you load a managed dll from a new created stack (in my case using CreateFiber) and this dll loads the clr.dll into the process space, then the following happens: After the coroutine is finished (i.e. the fiber is deleted) the VectoredExceptionHandler installed by clr.dll is invalid, thus on the first exception thrown the program crashes. The crash won't happen if the clr.dll was already loaded on the main-execution-threads stack. I also reported this problem to microsoft: https://connect.microsoft.com/VisualStudio/feedback/details/1053214/loading-... Tobias -- View this message in context: http://boost.2283326.n4.nabble.com/coroutine-x86-msvc11-stack-corruption-tp4... Sent from the Boost - Dev mailing list archive at Nabble.com.
participants (2)
-
Oliver Kowalke
-
Tobias Loew