Hi Csaba,

I have finally cleared through my inbox to looking closely at this
issue and the suggested bug fix.  I believe your suggested change is
safe in normal execution for CullThreadPerCameraDrawThreadPerContext
and DrawThreadPerContext, as the the _startRenderingBarrier barrier
being joined will be holding back the graphics threads, and calling
the reset of the block before joing this barrier will only release the
graphics threads to join this barrier - they can't go one to next
frame till the main thread joins the barrier.

WIth your patch applied all the OSG example still run fine even when I
set OSG_THREADING to
CullThreadPerCameraDrawThreadPerContext, but then these run OK before
anyway... so it's no 100% confirmation of a fix, but it's also close
as I can get without ever having reproduced the hang myself.  Such is
the way with threading bugs...

My thanks for your perseverance on this.  The fix is now checked into
svn and will be part of 2.7.5 dev release.  I also fixed the type of
ThreadSafeQueue as well.

Cheers,
Robert.




On Fri, Oct 17, 2008 at 4:02 PM, Csaba Halász <[EMAIL PROTECTED]> wrote:
> On Thu, Oct 16, 2008 at 2:42 PM, Robert Osfield
> <[EMAIL PROTECTED]> wrote:
>> HI Csaba,
>>
>> I suspect the particular problem you are seeing is not directly driver
>> related, but is an OSG bug, differences in drivers might change the
>> timing slightly which leads to the problem not becoming visible, but
>> may well still be lurking.
>
> Hi Robert,
>
> Huh, took me two days, but I think I have traced this to a race condition.
> Apparently the _endDynamicDrawBlock was already reached by a graphics
> thread before the viewer got a chance to reset it.
> So then that draw thread was released (and subsequently blocked on the
> sceneview queue) and the viewer has gone to infinite wait on the
> _endDynamicDrawBlock later.
> This simpe patch (that doesn't even hint at how difficult it is to
> trace such bugs) seems to fix the issue here:
>
> Index: src/osgViewer/ViewerBase.cpp
> ===================================================================
> --- src/osgViewer/ViewerBase.cpp        (revision 9034)
> +++ src/osgViewer/ViewerBase.cpp        (working copy)
> @@ -674,14 +674,14 @@
>
>     bool doneMakeCurrentInThisThread = false;
>
> -    // dispatch the the rendering threads
> -    if (_startRenderingBarrier.valid()) _startRenderingBarrier->block();
> -
>     if (_endDynamicDrawBlock.valid())
>     {
>         _endDynamicDrawBlock->reset();
>     }
>
> +    // dispatch the the rendering threads
> +    if (_startRenderingBarrier.valid()) _startRenderingBarrier->block();
> +
>     // reset any double buffer graphics objects
>     for(Cameras::iterator camItr = cameras.begin();
>         camItr != cameras.end();
>
> I am not even sure why the _endDynamicDrawBlock has to be reset. Comments?
>
> --
> Csaba
> _______________________________________________
> osg-users mailing list
> osg-users@lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
_______________________________________________
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to