Hi, I've been experiencing regular segmentation faults on Linux when using the database pager heavily, and it looks to me like it's caused by a particular pattern of non-threadsafe code. The PROPERTY macro defined in DataTypes writes into a statically allocated std::string each time it's used, and since the InputStream winds up calling that macro from multiple threads with no locking mechanism, it eventually gets into a simultaneous writing scenario, overruns the string's buffer, and corrupts memory.
I see that there's some code in the InputStream commented out with a #if 0, which used a stack-allocated osgDB::ObjectProperty object instead of the static from PROPERTY. I'd suggest as a fix returning to that pattern, and removing the PROPERTY macro entirely since there's no reasonable way to make it threadsafe (at least not that I can think of). I've applied that change locally to my build of OpenSceneGraph, and the segfaults have stopped. If this is a change you want to integrate, I can send a zip of the diffs (against the 3.0.1 release), or just zip up the patched files. Thanks, Max Bandazian
_______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
