Hi Robert, This explains the behavior we have experienced, the crashes we observed were notoriously difficult to reproduce in a debug environment (gdb, valgrind, etc.).
Thanks for taking your time to investigate this! Ola On 20 aug 2012, at 18.41, Robert Osfield wrote: > Hi Ola, > > I've been doing a code review of Terrain and TerrainTile looking at > how deletion of TerrainTile will affect the internal TerrainTile > pointers held in Terrain that track all the tiles. There internal > TerrainTile pointers in Terrain are protected by a reentrant mutex but > I believe a problem can occur when the TerrainTile destructor calls > Terrain::unregisterTerrainTile(TerrainTile*) when at the same time the > Terrain::traverse(NodeVisitor&) method is taking a copy of the > _updateTerrainTileSet, when this occurs the update traversal would > increment the ref count on an TerrainTile being destructed by the > DatabasePager thread that is cleaning up expired tiles. > > This issue boils down to attempt to make a thread safe list > TerrainTile observers in Terrain that doesn't quite achieve what it > intends. I haven't thought deeply enough about the issue yet to know > what the best solution will be. My head isn't quite into zone that > will allow me to solve this one so I'll have to come back to it at a > later date. A short term solution would be set the pager so that it > doesn't delete objects in a background pager thread via > DatabasePager::setDeleteRemovedSubgraphsInDatabaseThread(false), this > won't fix the thread safety issue but will at least prevent the > particular instance where the update traversal is occurring at the > same time as the deletion of TerrainTile. > > Robert. > _______________________________________________ > 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

