Re: [osg-users] Segfaults in osg::State::applyTextureAttributes when working with osgText::Text

2008-08-22 Thread Alexander Löffler

Alexander Löffler wrote:
I am experiencing very frequent segfaults in OSG'S rendering thread when 
working with osgText::Text objects. The problem always appears in 
State::applyTextureAttributes(), but at different positions in there. 
Most of the time in StateAttribute::getTypeMemberPair(), though, an 
exemplary backtrace for this is attached.


The crash happens when changing text attributes, like color and size, 
but also when manipulating higher-level objects in the scene graph 
(setting NodeMasks of subgraphs containing the Text, etc.).


Has anyone experienced similar behavior before? It always seems to be 
connected to updates of textures, especially when having overlapping 
textures like Text on top of an image texture.


Could this also be somehow related to third party libraries like Freetype?

Thanks a lot for your help,
Alex.

BTW, I am working with OSG 2.6.0 under Linux (SUSE, GCC 4.2.1) and an 
nVidia GeForce 8400.


Oh, I forgot to mention that the segfaults happen only when running the 
osgViewer displaying my scene in any of the multithreaded modes. When switching 
the TreadingModel to SingleThreaded, none of the errors occur anymore.


Thanks again,
Alex.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Segfaults in osg::State::applyTextureAttributes when working with osgText::Text

2008-08-22 Thread David Spilling
Alex,

There was a whole load of message traffic on this topic a while ago. From
what I remember, the upshot was that the freetype library wasn't thread
safe. I don't know whether it all got finally resolved or not; my advice
would be to check the archives.

David
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Segfaults in osg::State::applyTextureAttributes when working with osgText::Text

2008-08-22 Thread Robert Osfield
Hi Alexander,

Are you dynamically modifying the text?  If so then just set the
DataVariance of the Text objects to DYNAMIC.

Explanation : When running in DrawThreadPerContext, and
CullThreadPerCameraDrawThreadPerContext the update,cull of the next
frame is allowed to overlap with rendering of the previous frame.
This also means that their is potential for the update phase to be
modifying the scene graph at the same time that its being read - which
causes crashes.  The mechinism for prevent these read/write collisions
is to set the dynamically modified Drawables and
StateSet/StateAttribute to have a DataVariance of DYNAMIC, and then
the rendering traversal then holds back the next frame till all
DYNAMIC objects have been drawn.

This topic has been written about lots of time on osg-users over the
past year, and also mentioned in the Quick Start Guide.

Robert.

On Fri, Aug 22, 2008 at 10:36 AM, Alexander Löffler
[EMAIL PROTECTED] wrote:
 Hi all,

 I am experiencing very frequent segfaults in OSG'S rendering thread when
 working with osgText::Text objects. The problem always appears in
 State::applyTextureAttributes(), but at different positions in there. Most
 of the time in StateAttribute::getTypeMemberPair(), though, an exemplary
 backtrace for this is attached.

 The crash happens when changing text attributes, like color and size, but
 also when manipulating higher-level objects in the scene graph (setting
 NodeMasks of subgraphs containing the Text, etc.).

 Has anyone experienced similar behavior before? It always seems to be
 connected to updates of textures, especially when having overlapping
 textures like Text on top of an image texture.

 Could this also be somehow related to third party libraries like Freetype?

 Thanks a lot for your help,
 Alex.

 BTW, I am working with OSG 2.6.0 under Linux (SUSE, GCC 4.2.1) and an nVidia
 GeForce 8400.

 --

 #0  0xb6dba374 in osg::StateAttribute::getTypeMemberPair (this=0x862b7f0)
at /home/al/src/OpenSceneGraph-2.6.0/include/osg/StateAttribute:228
 #1  0xb6dc2945 in osg::State::applyTextureAttribute (this=0x8212840, unit=0,
 attribute=0x862b7f0)
at /home/al/src/OpenSceneGraph-2.6.0/include/osg/State:335
 #2  0xb60ec704 in osgText::Text::renderOnlyForegroundText (this=0xac1213e0,
 [EMAIL PROTECTED], [EMAIL PROTECTED])
at /home/al/src/OpenSceneGraph-2.6.0/src/osgText/Text.cpp:1750
 #3  0xb60efc1a in osgText::Text::drawImplementation (this=0xac1213e0,
 [EMAIL PROTECTED], [EMAIL PROTECTED])
at /home/al/src/OpenSceneGraph-2.6.0/src/osgText/Text.cpp:1365
 #4  0xb60f01ee in osgText::Text::drawImplementation (this=0xac1213e0,
 [EMAIL PROTECTED])
at /home/al/src/OpenSceneGraph-2.6.0/src/osgText/Text.cpp:1252
 #5  0xb63cb5cb in osg::Drawable::draw (this=0xac1213e0,
 [EMAIL PROTECTED])
at /home/al/src/OpenSceneGraph-2.6.0/include/osg/Drawable:895
 #6  0xb63ca508 in osgUtil::RenderLeaf::render (this=0x83114f0,
 [EMAIL PROTECTED], previous=0x8315610)
at /home/al/src/OpenSceneGraph-2.6.0/src/osgUtil/RenderLeaf.cpp:60
 #7  0xb63bed52 in osgUtil::RenderBin::drawImplementation (this=0x8969248,
 [EMAIL PROTECTED], [EMAIL PROTECTED])
at /home/al/src/OpenSceneGraph-2.6.0/src/osgUtil/RenderBin.cpp:419
 #8  0xb63be5cd in osgUtil::RenderBin::draw (this=0x8969248,
 [EMAIL PROTECTED], [EMAIL PROTECTED])
at /home/al/src/OpenSceneGraph-2.6.0/src/osgUtil/RenderBin.cpp:384
 #9  0xb63befe4 in osgUtil::RenderBin::drawImplementation (this=0x8215bb8,
 [EMAIL PROTECTED], [EMAIL PROTECTED])
at /home/al/src/OpenSceneGraph-2.6.0/src/osgUtil/RenderBin.cpp:469
 #10 0xb63cc062 in osgUtil::RenderStage::drawImplementation (this=0x8215bb8,
 [EMAIL PROTECTED], [EMAIL PROTECTED])
at /home/al/src/OpenSceneGraph-2.6.0/src/osgUtil/RenderStage.cpp:1233
 #11 0xb63be5cd in osgUtil::RenderBin::draw (this=0x8215bb8,
 [EMAIL PROTECTED], [EMAIL PROTECTED])
at /home/al/src/OpenSceneGraph-2.6.0/src/osgUtil/RenderBin.cpp:384
 #12 0xb63ccb48 in osgUtil::RenderStage::drawInner (this=0x8215bb8,
 [EMAIL PROTECTED], [EMAIL PROTECTED],
[EMAIL PROTECTED]) at
 /home/al/src/OpenSceneGraph-2.6.0/src/osgUtil/RenderStage.cpp:829
 #13 0xb63cf995 in osgUtil::RenderStage::draw (this=0x8215bb8,
 [EMAIL PROTECTED], [EMAIL PROTECTED])
at /home/al/src/OpenSceneGraph-2.6.0/src/osgUtil/RenderStage.cpp:1090
 #14 0xb63dda57 in osgUtil::SceneView::draw (this=0x8214d60) at
 /home/al/src/OpenSceneGraph-2.6.0/src/osgUtil/SceneView.cpp:1509
 #15 0xb6a9f756 in osgViewer::Renderer::draw (this=0x8214b60) at
 /home/al/src/OpenSceneGraph-2.6.0/src/osgViewer/Renderer.cpp:413
 #16 0xb6a9b2db in osgViewer::Renderer::operator() (this=0x8214b60,
 context=0x80bbe58)
at /home/al/src/OpenSceneGraph-2.6.0/src/osgViewer/Renderer.cpp:640
 #17 0xb6e0d96c in osg::GraphicsContext::runOperations (this=0x80bbe58)
at /home/al/src/OpenSceneGraph-2.6.0/src/osg/GraphicsContext.cpp:688
 #18 0xb6e18fd5 in osg::RunOperations::operator() (this=0x82171d8,
 context=0x80bbe58)
at 

Re: [osg-users] Segfaults in osg::State::applyTextureAttributes when working with osgText::Text

2008-08-22 Thread Alexander Löffler

Hi David,

David Spilling wrote:

There was a whole load of message traffic on this topic a while ago. From
what I remember, the upshot was that the freetype library wasn't thread
safe. I don't know whether it all got finally resolved or not; my advice
would be to check the archives.


thanks for your quick answer. I saw these threads:

http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg01489.html
http://www.mail-archive.com/osg-users@lists.openscenegraph.org/msg05841.html

Both sounded quite resolved to me in the end (but maybe the the original 
authors can veto on that). I also ran the multithreaded example mentioned 
(osgtext --mt) with 5 threads and more without a crash or even the slightest 
problem. That is why I thought those problems would not apply anymore. Also, the 
posts are up to a year old and text seems to me being something that many people 
need. Also in a multithreaded application. :)


Anyways, my problems are quite similar; so it is probable the crashes are 
somehow freetype's fault. Can somebody say something about the status of 
multithreaded text in the current OSG?


Alex.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org


Re: [osg-users] Segfaults in osg::State::applyTextureAttributes when working with osgText::Text

2008-08-22 Thread Alexander Löffler

Hi Robert,

Robert Osfield wrote:

Hi Alexander,

Are you dynamically modifying the text?  If so then just set the
DataVariance of the Text objects to DYNAMIC.

Explanation : When running in DrawThreadPerContext, and
CullThreadPerCameraDrawThreadPerContext the update,cull of the next
frame is allowed to overlap with rendering of the previous frame.
This also means that their is potential for the update phase to be
modifying the scene graph at the same time that its being read - which
causes crashes.  The mechinism for prevent these read/write collisions
is to set the dynamically modified Drawables and
StateSet/StateAttribute to have a DataVariance of DYNAMIC, and then
the rendering traversal then holds back the next frame till all
DYNAMIC objects have been drawn.

This topic has been written about lots of time on osg-users over the
past year, and also mentioned in the Quick Start Guide.


yes, I dynamically modify text a lot in my application and setting the 
DataVariance correctly completely resolved the issue for now. I've used 
DataVariance a lot, but saw it more as an optimization device and didn't know 
that setting it wrong could cause such problems.


Thanks a lot for your immediate help,
Alex.
___
osg-users mailing list
osg-users@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org