No answers, but I have seen in my own work that adding a new view to an existing (and running) CompositeViewer causes a crash when the CompositeViewer was running in anything other than single-threaded mode when it tries to stop the thread to add the new view (inside CompositeViewer). I had just assumed I was doing something wrong...which may still be the case, but it sounds similar enough to your problem.
- John -----Original Message----- From: Jean-Sébastien Guay [mailto:[EMAIL PROTECTED] Sent: Tuesday, November 18, 2008 9:10 AM To: OpenSceneGraph Users Subject: Re: [osg-users] CompositeViewer addView threading issue on Windows? Hi all, No answers yet, so either I was too verbose and scared off people or no one has anything to say... I should mention, I would be interested if someone would try the example I attached to the last mail even on other platforms than Windows (Linux mostly) to see if I'm doing anything wrong in a more general sense. Thanks in advance, J-S Jean-Sébastien Guay wrote: > Hi all, > > We're currently creating a new app where we need to be able to create > new views, each of which needs to have a separate graphics context > (because they need to be attached to Qt windows - so each needs to get a > unique window handle). > > When adding views, I'm hitting what seems to be a threading issue > (deadlock or something like that). It'll happen after adding 2, 3 or 4 > views, not always the same number, but I can rarely get more than 5 > total. On the call stack, I can see one thread per context is in > GraphicsWindowWin32::makeCurrentImpl() (this is DrawThreadPerContext, so > that's ok), and a third one is in ViewerBase::renderingTraversals() on a > conditionalWait, and they all seem to be stalled there. I'll copy the > stack traces below. > > I've reproduced the problem even without Qt, by modifying osgviewer.cpp, > adding an event handler that just creates a new view, calls > setUpViewInWindow() and sets the scene root on it to the same as the > first view. I've tried surrounding the addView call with stopThreading() > and startThreading(), but it doesn't seem to change anything. > > I've attached my modified osgviewer.cpp. If someone's inclined to try it > out, just start it with cow.osg for example, and press 'a' to add a view > (note that the 'a' key will only work on the first window). > > Is there anything else I need to be careful of when adding views at run > time? Anything I need to do to make this work? > > Thanks in advance, > > J-S > > > Stack traces: > > Thread 1 > ========================================================================= > [EMAIL PROTECTED]() > [EMAIL PROTECTED]() + 0xc bytes > [EMAIL PROTECTED]() + 0x84 bytes > [EMAIL PROTECTED]() + 0x12 bytes > ot11-OpenThreadsd.dll!OpenThreads::cooperativeWait(void * > waitHandle=0x00000318, unsigned long timeout=4294967295) Line 55 + 0x10 > bytes C++ > > > ot11-OpenThreadsd.dll!OpenThreads::Win32ConditionPrivateData::wait(OpenThreads::Mutex > > & external_mutex={...}, long timeout_ms=-1) Line 109 + 0x1d bytes C++ > > ot11-OpenThreadsd.dll!OpenThreads::Condition::wait(OpenThreads::Mutex * > mutex=0x0237c1e4) Line 63 C++ > osg50-osgViewerd.dll!OpenThreads::BlockCount::block() Line 133 + > 0x17 bytes C++ > osg50-osgViewerd.dll!osgViewer::ViewerBase::renderingTraversals() > Line 753 C++ > osg50-osgViewerd.dll!osgViewer::ViewerBase::frame(double > simulationTime=1.7976931348623157e+308) Line 608 + 0xf bytes C++ > osg50-osgViewerd.dll!osgViewer::ViewerBase::run() Line 580 + 0x1b > bytes C++ > osg50-osgViewerd.dll!osgViewer::CompositeViewer::run() Line 219 > C++ > AddView.exe!main(int argc=2, char * * argv=0x0229c828) Line 177 + > 0xe bytes C++ > AddView.exe!__tmainCRTStartup() Line 597 + 0x19 bytes C > AddView.exe!mainCRTStartup() Line 414 C > [EMAIL PROTECTED]@12() + 0x12 bytes > [EMAIL PROTECTED]() + 0x27 bytes > [EMAIL PROTECTED]() + 0x1b bytes > > Thread 2 > ========================================================================= > > [EMAIL PROTECTED]() > [EMAIL PROTECTED]() + 0xc bytes > [EMAIL PROTECTED]() - 0x51 bytes > [EMAIL PROTECTED]() + 0xd7 bytes > [EMAIL PROTECTED]() + 0x1f bytes > nvoglv32.dll!6970f597() > [Frames below may be incorrect and/or missing, no symbols loaded > for nvoglv32.dll] > [EMAIL PROTECTED]@12() + 0x12 bytes > [EMAIL PROTECTED]() + 0x27 bytes > [EMAIL PROTECTED]() + 0x1b bytes > > Thread 3 > ========================================================================= > > [EMAIL PROTECTED]() > [EMAIL PROTECTED]() + 0xc bytes > [EMAIL PROTECTED]() + 0x84 bytes > [EMAIL PROTECTED]() + 0x12 bytes > nvoglv32.dll!69705b31() > [Frames below may be incorrect and/or missing, no symbols loaded > for nvoglv32.dll] > nvoglv32.dll!696215b0() > nvoglv32.dll!69621f14() > nvoglv32.dll!697057a9() > [EMAIL PROTECTED]@12() + 0x12 bytes > [EMAIL PROTECTED]() + 0x27 bytes > [EMAIL PROTECTED]() + 0x1b bytes > > Thread 4 > ========================================================================= > nvoglv32.dll!69621881() > [Frames below may be incorrect and/or missing, no symbols loaded > for nvoglv32.dll] > nvoglv32.dll!69714ba0() > nvoglv32.dll!6970416c() > [EMAIL PROTECTED]() + 0x3b bytes > [EMAIL PROTECTED]() + 0xd5 bytes > [EMAIL PROTECTED]() + 0x8e bytes > > osg50-osgViewerd.dll!osgViewer::GraphicsWindowWin32::makeCurrentImplementation() > > Line 1701 + 0x1c bytes C++ > > osg50-osgd.dll!osg::GraphicsContext::makeCurrent() Line 512 + 0xf > bytes C++ > osg50-osgd.dll!osg::GraphicsThread::run() Line 35 C++ > > ot11-OpenThreadsd.dll!OpenThreads::ThreadPrivateActions::StartThread(void > * data=0x0232e97c) Line 113 + 0xf bytes C++ > msvcr80d.dll!_callthreadstartex() Line 348 + 0xf bytes C > msvcr80d.dll!_threadstartex(void * ptd=0x02362ef8) Line 331 C > [EMAIL PROTECTED]@12() + 0x12 bytes > [EMAIL PROTECTED]() + 0x27 bytes > [EMAIL PROTECTED]() + 0x1b bytes > > Thread 5 > ========================================================================= > [EMAIL PROTECTED]() > [EMAIL PROTECTED]() + 0xc bytes > [EMAIL PROTECTED]() + 0x6 bytes > nvoglv32.dll!69621949() > [Frames below may be incorrect and/or missing, no symbols loaded > for nvoglv32.dll] > nvoglv32.dll!69714ba0() > nvoglv32.dll!697046aa() > [EMAIL PROTECTED]() + 0x97 bytes > [EMAIL PROTECTED]() + 0x169 bytes > [EMAIL PROTECTED]() + 0x8e bytes > > osg50-osgViewerd.dll!osgViewer::GraphicsWindowWin32::makeCurrentImplementation() > > Line 1693 + 0x1c bytes C++ > > osg50-osgd.dll!osg::GraphicsContext::makeCurrent() Line 512 + 0xf > bytes C++ > osg50-osgd.dll!osg::GraphicsThread::run() Line 35 C++ > > ot11-OpenThreadsd.dll!OpenThreads::ThreadPrivateActions::StartThread(void > * data=0x0234a61c) Line 113 + 0xf bytes C++ > msvcr80d.dll!_callthreadstartex() Line 348 + 0xf bytes C > msvcr80d.dll!_threadstartex(void * ptd=0x02363148) Line 331 C > [EMAIL PROTECTED]@12() + 0x12 bytes > [EMAIL PROTECTED]() + 0x27 bytes > [EMAIL PROTECTED]() + 0x1b bytes > > Thread 6 > ========================================================================= > > [EMAIL PROTECTED]() > [EMAIL PROTECTED]() + 0xc bytes > [EMAIL PROTECTED]() + 0xc8 bytes > [EMAIL PROTECTED]() - 0x4b84 bytes > [EMAIL PROTECTED]() + 0x281 bytes > nvoglv32.dll!6970568f() > [Frames below may be incorrect and/or missing, no symbols loaded > for nvoglv32.dll] > nvoglv32.dll!69621c04() > nvoglv32.dll!69714ec9() > nvoglv32.dll!6962149a() > nvoglv32.dll!69621f14() > nvoglv32.dll!697057a9() > [EMAIL PROTECTED]@12() + 0x12 bytes > [EMAIL PROTECTED]() + 0x27 bytes > [EMAIL PROTECTED]() + 0x1b bytes > > Thread 7 > ========================================================================= > [EMAIL PROTECTED]() > [EMAIL PROTECTED]() + 0xc bytes > [EMAIL PROTECTED]() + 0x6 bytes > nvoglv32.dll!69621949() > [Frames below may be incorrect and/or missing, no symbols loaded > for nvoglv32.dll] > nvoglv32.dll!69714ba0() > nvoglv32.dll!697046aa() > [EMAIL PROTECTED]() + 0x97 bytes > [EMAIL PROTECTED]() + 0x169 bytes > [EMAIL PROTECTED]() + 0x8e bytes > > osg50-osgViewerd.dll!osgViewer::GraphicsWindowWin32::makeCurrentImplementation() > > Line 1693 + 0x1c bytes C++ > > osg50-osgd.dll!osg::GraphicsContext::makeCurrent() Line 512 + 0xf > bytes C++ > osg50-osgd.dll!osg::GraphicsThread::run() Line 35 C++ > > ot11-OpenThreadsd.dll!OpenThreads::ThreadPrivateActions::StartThread(void > * data=0x0234b2fc) Line 113 + 0xf bytes C++ > msvcr80d.dll!_callthreadstartex() Line 348 + 0xf bytes C > msvcr80d.dll!_threadstartex(void * ptd=0x023635e8) Line 331 C > [EMAIL PROTECTED]@12() + 0x12 bytes > [EMAIL PROTECTED]() + 0x27 bytes > [EMAIL PROTECTED]() + 0x1b bytes > > Thread 8 > ========================================================================= > > [EMAIL PROTECTED]() > [EMAIL PROTECTED]() + 0xc bytes > [EMAIL PROTECTED]() + 0x6 bytes > nvoglv32.dll!69761ee8() > [Frames below may be incorrect and/or missing, no symbols loaded > for nvoglv32.dll] > nvoglv32.dll!697653c6() > nvoglv32.dll!6973029b() > [EMAIL PROTECTED]() + 0x5d bytes > nvoglv32.dll!69704ab9() > nvoglv32.dll!69714e96() > nvoglv32.dll!6962149a() > nvoglv32.dll!69621f14() > nvoglv32.dll!697057a9() > [EMAIL PROTECTED]@12() + 0x12 bytes > [EMAIL PROTECTED]() + 0x27 bytes > [EMAIL PROTECTED]() + 0x1b bytes > > Thread 9 > ========================================================================= > [EMAIL PROTECTED]() > [EMAIL PROTECTED]() + 0xc bytes > [EMAIL PROTECTED]() + 0x6 bytes > nvoglv32.dll!69621949() > [Frames below may be incorrect and/or missing, no symbols loaded > for nvoglv32.dll] > nvoglv32.dll!69714ba0() > nvoglv32.dll!697046aa() > [EMAIL PROTECTED]() + 0x97 bytes > [EMAIL PROTECTED]() + 0x169 bytes > [EMAIL PROTECTED]() + 0x8e bytes > > osg50-osgViewerd.dll!osgViewer::GraphicsWindowWin32::makeCurrentImplementation() > > Line 1693 + 0x1c bytes C++ > > osg50-osgd.dll!osg::GraphicsContext::makeCurrent() Line 512 + 0xf > bytes C++ > osg50-osgd.dll!osg::GraphicsThread::run() Line 35 C++ > > ot11-OpenThreadsd.dll!OpenThreads::ThreadPrivateActions::StartThread(void > * data=0x022d4c04) Line 113 + 0xf bytes C++ > msvcr80d.dll!_callthreadstartex() Line 348 + 0xf bytes C > msvcr80d.dll!_threadstartex(void * ptd=0x0237d230) Line 331 C > [EMAIL PROTECTED]@12() + 0x12 bytes > [EMAIL PROTECTED]() + 0x27 bytes > [EMAIL PROTECTED]() + 0x1b bytes > > Thread 10 > ========================================================================= > > [EMAIL PROTECTED]() > [EMAIL PROTECTED]() + 0xc bytes > [EMAIL PROTECTED]() + 0xc8 bytes > [EMAIL PROTECTED]() - 0x4b84 bytes > [EMAIL PROTECTED]() + 0x281 bytes > nvoglv32.dll!6970568f() > [Frames below may be incorrect and/or missing, no symbols loaded > for nvoglv32.dll] > nvoglv32.dll!6970490f() > nvoglv32.dll!69714e96() > nvoglv32.dll!6962149a() > nvoglv32.dll!69621f14() > nvoglv32.dll!697057a9() > [EMAIL PROTECTED]@12() + 0x12 bytes > [EMAIL PROTECTED]() + 0x27 bytes > [EMAIL PROTECTED]() + 0x1b bytes > > Thread 11 > ========================================================================= > [EMAIL PROTECTED]() > [EMAIL PROTECTED]() + 0xc bytes > [EMAIL PROTECTED]() + 0x6 bytes > nvoglv32.dll!69621949() > [Frames below may be incorrect and/or missing, no symbols loaded > for nvoglv32.dll] > nvoglv32.dll!69714ba0() > nvoglv32.dll!697046aa() > [EMAIL PROTECTED]() + 0x97 bytes > [EMAIL PROTECTED]() + 0x169 bytes > [EMAIL PROTECTED]() + 0x8e bytes > > osg50-osgViewerd.dll!osgViewer::GraphicsWindowWin32::makeCurrentImplementation() > > Line 1693 + 0x1c bytes C++ > > osg50-osgd.dll!osg::GraphicsContext::makeCurrent() Line 512 + 0xf > bytes C++ > osg50-osgd.dll!osg::GraphicsThread::run() Line 35 C++ > > ot11-OpenThreadsd.dll!OpenThreads::ThreadPrivateActions::StartThread(void > * data=0x022ef24c) Line 113 + 0xf bytes C++ > msvcr80d.dll!_callthreadstartex() Line 348 + 0xf bytes C > msvcr80d.dll!_threadstartex(void * ptd=0x0237d6d0) Line 331 C > [EMAIL PROTECTED]@12() + 0x12 bytes > [EMAIL PROTECTED]() + 0x27 bytes > [EMAIL PROTECTED]() + 0x1b bytes > > Thread 12 > ========================================================================= > > [EMAIL PROTECTED]() > [EMAIL PROTECTED]() + 0xc bytes > [EMAIL PROTECTED]() + 0xc8 bytes > [EMAIL PROTECTED]() - 0x4b84 bytes > [EMAIL PROTECTED]() + 0x281 bytes > nvoglv32.dll!6970568f() > [Frames below may be incorrect and/or missing, no symbols loaded > for nvoglv32.dll] > nvoglv32.dll!6970490f() > nvoglv32.dll!69714e96() > nvoglv32.dll!6962149a() > nvoglv32.dll!69621f14() > nvoglv32.dll!697057a9() > [EMAIL PROTECTED]@12() + 0x12 bytes > [EMAIL PROTECTED]() + 0x27 bytes > [EMAIL PROTECTED]() + 0x1b bytes > > Thread 13 > ========================================================================= > > [EMAIL PROTECTED]() > [EMAIL PROTECTED]() + 0xc bytes > [EMAIL PROTECTED]() + 0xc8 bytes > [EMAIL PROTECTED]() - 0x4b84 bytes > [EMAIL PROTECTED]() + 0x281 bytes > nvoglv32.dll!6970568f() > [Frames below may be incorrect and/or missing, no symbols loaded > for nvoglv32.dll] > nvoglv32.dll!696fdaba() > nvoglv32.dll!69704735() > nvoglv32.dll!69714e96() > nvoglv32.dll!6962149a() > nvoglv32.dll!69621f14() > nvoglv32.dll!697057a9() > [EMAIL PROTECTED]@12() + 0x12 bytes > [EMAIL PROTECTED]() + 0x27 bytes > [EMAIL PROTECTED]() + 0x1b bytes > > -- ______________________________________________________ Jean-Sebastien Guay [EMAIL PROTECTED] http://www.cm-labs.com/ http://whitestar02.webhop.org/ _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org