Hi Robert,
I tested with the current trunk, using osgViewer and environment variables:
OSG_NUM_DATABASE_THREADS=4
OSG_NUM_HTTP_DATABASE_THREADS=0
Also I used a large vpb generated .ive with is generated with the latest
version - some ealier versions have the tileID not correctly saved somehow,
which might prevent the deadlock from occuring.
After some moving around I got still the deadlock, the stack is at the end of
this post. There are 4 threads with a similar stack, and the threads wait for
each other. The osgViewer is actually not hanging - you can move around, but
the tiles are not updated any more. YOu have to pause the debugger and look at
the stack to see the deadlock.
The Problem is in the lines like:
if (updateNeighboursImmediately) right_tile->init(dirtyMask,
true);
One thread will try to init() the right neighbor, while another thread will
init() the left neighbor, then the thread deadlock because they lock first
thier own _writeBufferMutex, and then try to lock the _writeBufferMutex of the
neighbour.
I think for this setting updateNeighboursImmediately=false is a good solution.
Another option is to use tryLock() on the neighbours - and if this fails, set
the neighbours as dirty as in updateNeighboursImmediately=false
There is still the other deadlock within the Terrain class, for with I proposed
a solution before.
Regards,
Andreas
ot12-OpenThreadsd.dll!OpenThreads::Mutex::lock() Line 113 + 0xc bytes
C++
osg66-osgTerraind.dll!OpenThreads::ScopedLock<OpenThreads::Mutex>::ScopedLock<OpenThreads::Mutex>(OpenThreads::Mutex
& m={...}) Line 31 + 0x2a bytes C++
osg66-osgTerraind.dll!osgTerrain::GeometryTechnique::init(int
dirtyMask=1023, bool assumeMultiThreaded=true) Line 104 + 0xf bytes C++
osg66-osgTerraind.dll!osgTerrain::TerrainTile::init(int dirtyMask=1023,
bool assumeMultiThreaded=true) Line 184 + 0x29 bytes C++
>
> osg66-osgTerraind.dll!osgTerrain::GeometryTechnique::generateGeometry(osgTerrain::GeometryTechnique::BufferData
> & buffer={...}, osgTerrain::Locator * masterLocator=0x0d926e58, const
> osg::Vec3d & centerModel={...}) Line 953 + 0x26 bytes C++
osg66-osgTerraind.dll!osgTerrain::GeometryTechnique::init(int
dirtyMask=1023, bool assumeMultiThreaded=false) Line 137 + 0x20 bytes C++
osg66-osgTerraind.dll!osgTerrain::TerrainTile::init(int dirtyMask=1023,
bool assumeMultiThreaded=false) Line 184 + 0x29 bytes C++
osg66-osgTerraind.dll!osgTerrain::TerrainTile::traverse(osg::NodeVisitor &
nv={...}) Line 145 C++
osg66-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node={...}) Line
191 + 0x1c bytes C++
osg66-osgDBd.dll!osgDB::DatabasePager::FindCompileableGLObjectsVisitor::apply(osg::Node
& node={...}) Line 139 + 0xf bytes C++
osg66-osgd.dll!osg::NodeVisitor::apply(osg::Group & node={...}) Line
86 + 0x13 bytes C++
osg66-osgTerraind.dll!osgTerrain::TerrainTile::accept(osg::NodeVisitor
& nv={...}) Line 76 + 0x55 bytes C++
osg66-osgd.dll!osg::NodeAcceptOp::operator()(osg::ref_ptr<osg::Node>
node={...}) Line 356 + 0x5e bytes C++
osg66-osgd.dll!std::for_each<std::_Vector_iterator<osg::ref_ptr<osg::Node>,std::allocator<osg::ref_ptr<osg::Node>
>
>,osg::NodeAcceptOp>(std::_Vector_iterator<osg::ref_ptr<osg::Node>,std::allocator<osg::ref_ptr<osg::Node>
> > _First={_ptr=0x0d926c70 },
std::_Vector_iterator<osg::ref_ptr<osg::Node>,std::allocator<osg::ref_ptr<osg::Node>
> > _Last={_ptr=0xfdfdfdfd }, osg::NodeAcceptOp _Func={...}) Line 29 + 0x1f
bytes C++
osg66-osgd.dll!osg::PagedLOD::traverse(osg::NodeVisitor & nv={...})
Line 136 + 0x6c bytes C++
osg66-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node={...}) Line
191 + 0x1c bytes C++
osg66-osgDBd.dll!osgDB::DatabasePager::FindCompileableGLObjectsVisitor::apply(osg::Node
& node={...}) Line 139 + 0xf bytes C++
osg66-osgd.dll!osg::NodeVisitor::apply(osg::Group & node={...}) Line
86 + 0x13 bytes C++
osg66-osgd.dll!osg::NodeVisitor::apply(osg::LOD & node={...}) Line 156
+ 0x13 bytes C++
osg66-osgd.dll!osg::NodeVisitor::apply(osg::PagedLOD & node={...})
Line 161 + 0x13 bytes C++
osg66-osgd.dll!osg::PagedLOD::accept(osg::NodeVisitor & nv={...}) Line
32 + 0x41 bytes C++
osg66-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv={...}) Line
62 + 0x25 bytes C++
osg66-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node={...}) Line
191 + 0x1c bytes C++
osg66-osgDBd.dll!osgDB::DatabasePager::FindCompileableGLObjectsVisitor::apply(osg::Node
& node={...}) Line 139 + 0xf bytes C++
osg66-osgd.dll!osg::NodeVisitor::apply(osg::Group & node={...}) Line
86 + 0x13 bytes C++
osg66-osgd.dll!osg::Group::accept(osg::NodeVisitor & nv={...}) Line 38
+ 0x41 bytes C++
osg66-osgDBd.dll!osgDB::DatabasePager::DatabaseThread::run() Line 741
+ 0x34 bytes C++
ot12-OpenThreadsd.dll!OpenThreads::ThreadPrivateActions::StartThread(void *
data=0x00e47614) Line 113 + 0xf bytes C++
msvcr90d.dll!_callthreadstartex() Line 348 + 0xf bytes C
msvcr90d.dll!_threadstartex(void * ptd=0x02f99a60) Line 331 C
------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=28278#28278
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org