Paul Melis wrote:

Paul Melis wrote:

Wojciech Lewandowski wrote:

Thanks, a lot

Red frame should never happen. I change flag color to red at the begining of update callback and change it to green at the end of this callback. You have seen red then you just confirmed that there is a bug in OSG or OpenThreads. And update callback might get called at the same time as GL compile visitor traverses the same node. If this is not OpenThreads but OSG issue it may also happen in other OSes.

Can anyone check it under Linux or Apple ?



When I run your modified osgprerender example the red flag is shown the first second, after that it turns to green and stays that way. This is on a dual-core Linux system with nVidia hardware using the default threading model. If I set the threading model to single threaded (using the OSG_THREADING env. variable) the flag is green from the start.


And when I start out with single threaded mode and switch with 'm' during execution I notice the following:
- Sometimes the next iteration of the flag will be red
- Sometimes I something looking like two frames of the green flag interlaced and flickering. It's hard to explain, but I guess what happens is that two prerendered images are alternating, in a interlace-kind of way. Now that I toy around with it it actually seems not limited to the prerendering. I toggled statistics to the mode showing the framerate and when after a threading mode switch the flag display is flickering so is the statistics display. It looks like the frame rate text is displayed twice, but with different FPS values (and in a blocky font). This is probably all not very helpful, but I figured I'd report it

Gosh, I'm really spamming this thread (but it's friday afternoon around 5 and I don't want to start anything work-related/"serious" anymore ;-)). Valgrind comes with a tool that's supposedly able to find race conditions in applications that use pthreads. Running the flag testcase with this tool (called helgrind) the following is in the logging output:

==6604== Possible data race during write of size 4 at 0x4742D88
==6604== at 0x40F39A4: osg::Drawable::compileGLObjects(osg::RenderInfo&) const (Drawable.cpp:463) ==6604== by 0x445BF51: osgUtil::GLObjectsVisitor::apply(osg::Drawable&) (GLObjectsVisitor.cpp:78) ==6604== by 0x445C04E: osgUtil::GLObjectsVisitor::apply(osg::Geode&) (GLObjectsVisitor.cpp:51)
==6604==    by 0x411A078: osg::Geode::accept(osg::NodeVisitor&) (Geode:39)
==6604== by 0x415807F: osg::Group::traverse(osg::NodeVisitor&) (Group.cpp:62) ==6604== by 0x445AF6D: osgUtil::GLObjectsVisitor::apply(osg::Node&) (NodeVisitor:181) ==6604== by 0x409BE89: osg::NodeVisitor::apply(osg::Group&) (NodeVisitor:236)
==6604==    by 0x415AC60: osg::Group::accept(osg::NodeVisitor&) (Group:38)
==6604== by 0x415807F: osg::Group::traverse(osg::NodeVisitor&) (Group.cpp:62) ==6604== by 0x445AF6D: osgUtil::GLObjectsVisitor::apply(osg::Node&) (NodeVisitor:181) ==6604== by 0x409BE89: osg::NodeVisitor::apply(osg::Group&) (NodeVisitor:236)
==6604==    by 0x415AC60: osg::Group::accept(osg::NodeVisitor&) (Group:38)
==6604==   Old state: shared-readonly by threads #1, #2
==6604==   New state: shared-modified by threads #1, #2
==6604==   Reason:    this thread, #2, holds no consistent locks
==6604==   Location 0x4742D88 has never been protected by any lock

Line 463 of Drawable.cpp is globj = generateDisplayList(contextID, getGLObjectSizeHint());

Now, I'm not going to come to any conclusions, as I simple don't know enough of the threading setup in OSG, but perhaps somebody else can...

Have a good weekend!
Paul







Paul



Paul


Hi Wojtek,

As far as I know you did not see this under Vista. This particular bug shows only in XP.




Indeed, you remember correctly.

Btw. Can you check another piece of code ie: my modified prerender bug repro ? This might be related to threading handler problems you reported. I have posted it on 24-04-2008.

http://article.gmane.org/gmane.comp.graphics.openscenegraph.user/26960/match=conditionUpdateCallbackvsGLCompileObjectVisitor




Yep, I see the red flag too a the start, then it goes green (after a black flash on the screen). If I change the threading mode ('m'), I see the red flag, then it turns green, then the plane stops spinning (but the example doesn't crash, and I can't get a good stack trace of where it stops).

Weird. Anything else I can do to help?

J-S
--
______________________________________________________
Jean-Sebastien Guay    [EMAIL PROTECTED]
                               http://www.cm-labs.com/
                        http://whitestar02.webhop.org/
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org







_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to