Thanks Alberto (at Christopher ;-) changes merged and submitted to svn/trunk and OSG-3.2 branch.
On 17 September 2013 12:18, Alberto Luaces <[email protected]> wrote: > Hi, > > there is a bug report in the Ubuntu tracker that points to a bug when > loading multiple VRML files in parallel. Christopher R. Baker has > detected this bug and crafted a patch. In addition, libcoin has to be > also built with the "--enable-threadsafe" option. > > I copy here his report, extracted from > (https://bugs.launchpad.net/ubuntu/+source/openscenegraph/+bug/1211993) > and attach his fix. All credit is due to him: > > « > There are three instances of a classical method-local-static > multithreaded initialization bug in the Inventor plugin for OSG that > trigger various memory faults when reading multiple VRML files in > parallel via osgDB::readNodeFile. These bugs are of the form: > > static std::map<Stuff,OtherStuff> myHandyMap; > static bool once = true; > if(once) { ...fill myHandyMap; once = false } > ... use myHandyMap; > > To repeat: try loading multiple VRML files from multiple threads. The > liklihood of the bug depends on many factors, but my application, which > parallel-loads some dozens of small (<100K) VRML files on startup, > triggers this problem 25% of the time or more. > > The attached patch (inventor-plugin-multithread.patch) rectifies this > problem by: > > 1 - Inheriting MyHandyMap from std::map, then > 2 - Moving the map initialization into the derived constructor, which > 3 - Is intrinsically protected from multithread issues by g++ (and is > part of the C++ standard), unless you pass -fno-threadsafe-statics, > which is strongly discouraged by the man page. > » > > > > Regards, > > -- > Alberto > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org > _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
