[osg-users] segfaults with glDeleteShader

Voerman, L. l.voerman at rug.nl
Mon Nov 2 06:51:30 PST 2015


Just a quick remark,
I think the warning you see is caused by the State destructor deleting the
context's extensions:

file src/osg/State.cpp (line 138)

in State::~State()
         GLExtensions::Set(_contextID, 0);

I think it caused me problems with loosing the extensions wen a camera was
deleted, causing the databasethread to stop loading compressed images, as
it cannot query the openGL context.
I have no proposal for a fix yet, as I do not feel I fully understand the
intention of the code. Removing the "GLExtensions::Set()" call seemed to
remove my problem.

Laurens.

On Mon, Nov 2, 2015 at 2:19 PM, Robert Osfield <robert.osfield at gmail.com>
wrote:

> Hi Roman,
>
> I have just built osgearth git head, but had to make a couple of build
> fixes to enable me to compile it against OSG head which is OSG-3.5.0.  I
> have cloned osgearth on git hub and post my fixes to this:
>
> https://github.com/robertosfield/osgearth
>
> I haven't seen the error you have but do get a warning:
>
>    Error: OpenGL version test failed, requires valid graphics context.
>
> On exit from osgearth_viewer. This suggests that the GLExtensions object
> is be constructed during cleanup for some reason.  Since the GLExensions
> object is used when called glDeleteShader there is chance the error you
> seeing is related to this.
>
> However, if I run the same .earth file with osgviewer I get a clean exit
> with no warnings.
>
> Robert
>
>
> On 2 November 2015 at 09:55, Roman Grigoriev <grigoriev at gosniias.ru>
> wrote:
>
>> Hi, I use osg and osgearth git version under linux  Lubuntu 15.04 nvidia
>> 352 driver.
>> And got segfaults on delete shaders
>>
>> Code:
>>
>> #0  0x00007ffff34fbe09 in glDeleteShader () from
>> /usr/lib/nvidia-352/libGL.so.1
>> #1  0x00007ffff6c8bce5 in
>> osg::Shader::PerContextShader::~PerContextShader() () from
>> /usr/local/lib64/libosg.so.140
>> #2  0x00007ffff6c8bf59 in
>> osg::Shader::PerContextShader::~PerContextShader() () from
>> /usr/local/lib64/libosg.so.140
>> #3  0x00007ffff6c8c3ae in osg::Shader::ShaderObjects::~ShaderObjects() ()
>> from /usr/local/lib64/libosg.so.140
>> #4  0x00007ffff6c8ae8d in osg::Shader::releaseGLObjects(osg::State*)
>> const () from /usr/local/lib64/libosg.so.140
>> #5  0x00007ffff6c73375 in osg::Program::releaseGLObjects(osg::State*)
>> const () from /usr/local/lib64/libosg.so.140
>> #6  0x00007ffff7a8af81 in
>> osgEarth::VirtualProgram::releaseGLObjects(osg::State*) const () from
>> /usr/local/lib64/libosgEarth.so.0
>> #7  0x00007ffff7a2eb55 in osgEarth::StateSetCache::prune() () from
>> /usr/local/lib64/libosgEarth.so.0
>> #8  0x00007ffff7a2ea0e in osgEarth::StateSetCache::pruneIfNecessary() ()
>> from /usr/local/lib64/libosgEarth.so.0
>> #9  0x00007ffff7a2e8a5 in
>> osgEarth::StateSetCache::share(osg::ref_ptr<osg::StateAttribute>&,
>> osg::ref_ptr<osg::StateAttribute>&, bool) () from
>> /usr/local/lib64/libosgEarth.so.0
>> #10 0x00007ffff7a2db0a in (anonymous
>> namespace)::ShareStateAttributes::applyStateSet(osg::StateSet*) () from
>> /usr/local/lib64/libosgEarth.so.0
>> #11 0x00007ffff7a2d89c in (anonymous
>> namespace)::ShareStateAttributes::apply(osg::Node&) () from
>> /usr/local/lib64/libosgEarth.so.0
>> #12 0x00007ffff7895ef6 in osg::Group::accept(osg::NodeVisitor&) () from
>> /usr/local/lib64/libosgEarth.so.0
>> #13 0x00007ffff7a2e4fd in
>> osgEarth::StateSetCache::consolidateStateAttributes(osg::Node*) () from
>> /usr/local/lib64/libosgEarth.so.0
>> #14 0x00007ffff2e84753 in
>> osgEarth::Features::GeometryCompiler::compile(std::list<osg::ref_ptr<osgEarth::Features::Feature>,
>> std::allocator<osg::ref_ptr<osgEarth::Features::Feature> > >&,
>> osgEarth::Symbology::Style const&, osgEarth::Features::FilterContext
>> const&) () from /usr/local/lib64/libosgEarthFeatures.so.0
>> #15 0x00007ffff2e825cf in
>> osgEarth::Features::GeometryCompiler::compile(osgEarth::Features::FeatureCursor*,
>> osgEarth::Symbology::Style const&, osgEarth::Features::FilterContext
>> const&) ()
>>    from /usr/local/lib64/libosgEarthFeatures.so.0
>> #16 0x00007ffff2e6563b in
>> osgEarth::Features::GeomFeatureNodeFactory::createOrUpdateNode(osgEarth::Features::FeatureCursor*,
>> osgEarth::Symbology::Style const&, osgEarth::Features::FilterContext
>> const&, osg::ref_ptr<osg::Node>&) () from
>> /usr/local/lib64/libosgEarthFeatures.so.0
>> #17 0x00007ffff2e51339 in
>> osgEarth::Features::FeatureModelGraph::createStyleGroup(osgEarth::Symbology::Style
>> const&, std::list<osg::ref_ptr<osgEarth::Features::Feature>,
>> std::allocator<osg::ref_ptr<osgEarth::Features::Feature> > >&,
>> osgEarth::Features::FilterContext const&) () from
>> /usr/local/lib64/libosgEarthFeatures.so.0
>> #18 0x00007ffff2e51726 in
>> osgEarth::Features::FeatureModelGraph::createStyleGroup(osgEarth::Symbology::Style
>> const&, osgEarth::Symbology::Query const&,
>> osgEarth::Features::FeatureIndexBuilder*) ()
>>    from /usr/local/lib64/libosgEarthFeatures.so.0
>> #19 0x00007ffff2e4eeed in
>> osgEarth::Features::FeatureModelGraph::buildLevel(osgEarth::Features::FeatureLevel
>> const&, osgEarth::GeoExtent const&, osgEarth::TileKey const*) ()
>>    from /usr/local/lib64/libosgEarthFeatures.so.0
>> #20 0x00007ffff2e4e08a in
>> osgEarth::Features::FeatureModelGraph::load(unsigned int, unsigned int,
>> unsigned int, std::string const&) () from
>> /usr/local/lib64/libosgEarthFeatures.so.0
>> #21 0x00007ffff2e55d1a in
>> osgEarthFeatureModelPseudoLoader::readNode(std::string const&,
>> osgDB::Options const*) const () from
>> /usr/local/lib64/libosgEarthFeatures.so.0
>> #22 0x00007ffff67ecb73 in
>> osgDB::Registry::ReadNodeFunctor::doRead(osgDB::ReaderWriter&) const ()
>> from /usr/local/lib64/libosgDB.so.140
>> #23 0x00007ffff67e6903 in
>> osgDB::Registry::read(osgDB::Registry::ReadFunctor const&) () from
>> /usr/local/lib64/libosgDB.so.140
>> #24 0x00007ffff67e786f in
>> osgDB::Registry::readImplementation(osgDB::Registry::ReadFunctor const&,
>> osgDB::Options::CacheHintOptions) () from /usr/local/lib64/libosgDB.so.140
>> #25 0x00007ffff67e831f in
>> osgDB::Registry::readNodeImplementation(std::string const&, osgDB::Options
>> const*) () from /usr/local/lib64/libosgDB.so.140
>> #26 0x00007ffff679a5c6 in osgDB::DatabasePager::DatabaseThread::run() ()
>> from /usr/local/lib64/libosgDB.so.140
>> #27 0x00007ffff482bb5e in
>> OpenThreads::ThreadPrivateActions::StartThread(void*) () from
>> /usr/local/lib64/libOpenThreads.so.20
>> #28 0x00007ffff58c46aa in start_thread (arg=0x7fffc97fa700) at
>> pthread_create.c:333
>> #29 0x00007ffff5be1eed in clone () at
>> ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
>>
>>
>>
>>
>> So if I comment line 47 in Shader.cpp
>>         if (extensions->isGlslSupported) extensions->glDeleteShader(
>> globj );
>> and 51 in Program.cpp
>>         if (extensions->isGlslSupported) extensions->glDeleteProgram(
>> globj );
>> and I don't have segfaults.
>>
>> It's very easily to reproduse simple run osgearth_viewer with any earth
>> file.
>>
>> Thank you!
>>
>> Cheers,
>> Roman[/code]
>>
>> ------------------
>> Read this topic online here:
>> http://forum.openscenegraph.org/viewtopic.php?p=65510#65510
>>
>>
>>
>>
>>
>> _______________________________________________
>> osg-users mailing list
>> osg-users at lists.openscenegraph.org
>> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>>
>
>
> _______________________________________________
> osg-users mailing list
> osg-users at lists.openscenegraph.org
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20151102/86d258f0/attachment-0003.htm>


More information about the osg-users mailing list