How to resolve: RuntimeAssertionException: mSubRenderStateList.empty() failed. Sub render states still exists...

Problems building or running the engine, queries about how to use features etc.
slapin
Bronze Sponsor
Bronze Sponsor
Posts: 339
Joined: Fri May 23, 2025 5:04 pm
x 24

How to resolve: RuntimeAssertionException: mSubRenderStateList.empty() failed. Sub render states still exists...

Post by slapin »

Hi, all!
I have an assert at end of execution:
terminate called after throwing an instance of 'Ogre::RuntimeAssertionException'
what(): RuntimeAssertionException: mSubRenderStateList.empty() failed. Sub render states still exists in SubRenderStateFactory at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderSubRenderState.cpp (line 53)

and I don't create any manual render states. How to fix it?

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 339
Joined: Fri May 23, 2025 5:04 pm
x 24

Re: How to resolve: RuntimeAssertionException: mSubRenderStateList.empty() failed. Sub render states still exists...

Post by slapin »

@paroj please help with finding source of this one...

paroj
OGRE Team Member
OGRE Team Member
Posts: 2274
Joined: Sun Mar 30, 2014 2:51 pm
x 1239

Re: How to resolve: RuntimeAssertionException: mSubRenderStateList.empty() failed. Sub render states still exists...

Post by paroj »

check the backtrace in GDB. Typically this means you have a MaterialPtr after Root was destroyed. This is invalid.

slapin
Bronze Sponsor
Bronze Sponsor
Posts: 339
Joined: Fri May 23, 2025 5:04 pm
x 24

Re: How to resolve: RuntimeAssertionException: mSubRenderStateList.empty() failed. Sub render states still exists...

Post by slapin »

The backtrace:

Code: Select all

#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737331636224) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140737331636224) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140737331636224, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff6442476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff64287f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff68a4f26 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff68b6d9c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff68b5d49 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x00007ffff68b64b9 in __gxx_personality_v0 () from /lib/x86_64-linux-gnu/libstdc++.so.6
#9  0x00007ffff770ea99 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#10 0x00007ffff770f1c1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#11 0x00007ffff68b705b in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#12 0x00007ffff7a576c6 in Ogre::ExceptionFactory::_throwException (code=Ogre::Exception::ERR_RT_ASSERTION_FAILED, number=7, desc="mSubRenderStateList.empty() failed. Sub render states still exists", 
    src="~SubRenderStateFactory", file=0x7ffff7afb978 "/media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderSubRenderState.cpp", line=53)
    at /media/slapin/library/ogre3/ogre/OgreMain/include/OgreException.h:268
#13 0x00007ffff7a57915 in Ogre::ExceptionFactory::throwException (code=Ogre::Exception::ERR_RT_ASSERTION_FAILED, desc="mSubRenderStateList.empty() failed. Sub render states still exists", 
    src="~SubRenderStateFactory", file=0x7ffff7afb978 "/media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderSubRenderState.cpp", line=53)
    at /media/slapin/library/ogre3/ogre/OgreMain/include/OgreException.h:280
#14 0x00007ffff7aee262 in Ogre::RTShader::SubRenderStateFactory::~SubRenderStateFactory (this=0x555556ae2a40, __in_chrg=<optimized out>)
    at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderSubRenderState.cpp:53
#15 0x00007ffff7a9448a in Ogre::RTShader::FFPTransformFactory::~FFPTransformFactory (this=0x555556ae2a40, __in_chrg=<optimized out>)
    at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderFFPTransform.h:91
#16 0x00007ffff7a944aa in Ogre::RTShader::FFPTransformFactory::~FFPTransformFactory (this=0x555556ae2a40, __in_chrg=<optimized out>)
    at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderFFPTransform.h:91
#17 0x00007ffff7aaa2b1 in Ogre::RTShader::ShaderGenerator::destroyBuiltinSRSFactories (this=0x5555565820f0) at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderGenerator.cpp:378
#18 0x00007ffff7aaa0b4 in Ogre::RTShader::ShaderGenerator::_destroy (this=0x5555565820f0) at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderGenerator.cpp:340
#19 0x00007ffff7aa9e84 in Ogre::RTShader::ShaderGenerator::destroy () at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderGenerator.cpp:304
#20 0x00007ffff783f23f in OgreBites::ApplicationContextBase::destroyRTShaderSystem (this=0x7fffffffdb70) at /media/slapin/library/ogre3/ogre/Components/Bites/src/OgreApplicationContextBase.cpp:162
#21 0x00007ffff784252a in OgreBites::ApplicationContextBase::shutdown (this=0x7fffffffdb70) at /media/slapin/library/ogre3/ogre/Components/Bites/src/OgreApplicationContextBase.cpp:639
#22 0x00007ffff786db7a in OgreBites::ApplicationContextSDL::shutdown (this=0x7fffffffdb70) at /media/slapin/library/ogre3/ogre/Components/Bites/src/OgreApplicationContextSDL.cpp:136
#23 0x00007ffff783ee94 in OgreBites::ApplicationContextBase::closeApp (this=0x7fffffffdb70) at /media/slapin/library/ogre3/ogre/Components/Bites/src/OgreApplicationContextBase.cpp:83
#24 0x00005555555c363d in main () at /media/slapin/library/ogre3/ogre-projects/world2/Game.cpp:841

Code: Select all

terminate called after throwing an instance of 'Ogre::RuntimeAssertionException'
  what():  RuntimeAssertionException: mSubRenderStateList.empty() failed. Sub render states still exists in ~SubRenderStateFactory at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderSubRenderState.cpp (line 53)

Thread 1 "Editor" received signal SIGABRT, Aborted.
__pthread_kill_implementation (no_tid=0, signo=6, threadid=140737331636224) at ./nptl/pthread_kill.c:44
44	./nptl/pthread_kill.c: No such file or directory.
(gdb) bt
#0  __pthread_kill_implementation (no_tid=0, signo=6, threadid=140737331636224) at ./nptl/pthread_kill.c:44
#1  __pthread_kill_internal (signo=6, threadid=140737331636224) at ./nptl/pthread_kill.c:78
#2  __GI___pthread_kill (threadid=140737331636224, signo=signo@entry=6) at ./nptl/pthread_kill.c:89
#3  0x00007ffff6442476 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4  0x00007ffff64287f3 in __GI_abort () at ./stdlib/abort.c:79
#5  0x00007ffff68a4f26 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#6  0x00007ffff68b6d9c in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#7  0x00007ffff68b5d49 in ?? () from /lib/x86_64-linux-gnu/libstdc++.so.6
#8  0x00007ffff68b64b9 in __gxx_personality_v0 () from /lib/x86_64-linux-gnu/libstdc++.so.6
#9  0x00007ffff770ea99 in ?? () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#10 0x00007ffff770f1c1 in _Unwind_RaiseException () from /lib/x86_64-linux-gnu/libgcc_s.so.1
#11 0x00007ffff68b705b in __cxa_throw () from /lib/x86_64-linux-gnu/libstdc++.so.6
#12 0x00007ffff7a576c6 in Ogre::ExceptionFactory::_throwException (code=Ogre::Exception::ERR_RT_ASSERTION_FAILED, number=7, desc="mSubRenderStateList.empty() failed. Sub render states still exists", 
    src="~SubRenderStateFactory", file=0x7ffff7afb978 "/media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderSubRenderState.cpp", line=53)
    at /media/slapin/library/ogre3/ogre/OgreMain/include/OgreException.h:268
#13 0x00007ffff7a57915 in Ogre::ExceptionFactory::throwException (code=Ogre::Exception::ERR_RT_ASSERTION_FAILED, desc="mSubRenderStateList.empty() failed. Sub render states still exists", 
    src="~SubRenderStateFactory", file=0x7ffff7afb978 "/media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderSubRenderState.cpp", line=53)
    at /media/slapin/library/ogre3/ogre/OgreMain/include/OgreException.h:280
#14 0x00007ffff7aee262 in Ogre::RTShader::SubRenderStateFactory::~SubRenderStateFactory (this=0x555556a00fc0, __in_chrg=<optimized out>)
    at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderSubRenderState.cpp:53
#15 0x00007ffff7a9448a in Ogre::RTShader::FFPTransformFactory::~FFPTransformFactory (this=0x555556a00fc0, __in_chrg=<optimized out>)
    at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderFFPTransform.h:91
#16 0x00007ffff7a944aa in Ogre::RTShader::FFPTransformFactory::~FFPTransformFactory (this=0x555556a00fc0, __in_chrg=<optimized out>)
    at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderFFPTransform.h:91
#17 0x00007ffff7aaa2b1 in Ogre::RTShader::ShaderGenerator::destroyBuiltinSRSFactories (this=0x5555569fe9b0) at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderGenerator.cpp:378
#18 0x00007ffff7aaa0b4 in Ogre::RTShader::ShaderGenerator::_destroy (this=0x5555569fe9b0) at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderGenerator.cpp:340
#19 0x00007ffff7aa9e84 in Ogre::RTShader::ShaderGenerator::destroy () at /media/slapin/library/ogre3/ogre/Components/RTShaderSystem/src/OgreShaderGenerator.cpp:304
#20 0x00007ffff783f23f in OgreBites::ApplicationContextBase::destroyRTShaderSystem (this=0x7fffffffdb80) at /media/slapin/library/ogre3/ogre/Components/Bites/src/OgreApplicationContextBase.cpp:162
#21 0x00007ffff784252a in OgreBites::ApplicationContextBase::shutdown (this=0x7fffffffdb80) at /media/slapin/library/ogre3/ogre/Components/Bites/src/OgreApplicationContextBase.cpp:639
#22 0x00007ffff786db7a in OgreBites::ApplicationContextSDL::shutdown (this=0x7fffffffdb80) at /media/slapin/library/ogre3/ogre/Components/Bites/src/OgreApplicationContextSDL.cpp:136
#23 0x00007ffff783ee94 in OgreBites::ApplicationContextBase::closeApp (this=0x7fffffffdb80) at /media/slapin/library/ogre3/ogre/Components/Bites/src/OgreApplicationContextBase.cpp:83
#24 0x00005555555c3441 in main () at /media/slapin/library/ogre3/ogre-projects/world2/src/editor/main.cpp:733

Do I have to manually destroy all the materials?

paroj
OGRE Team Member
OGRE Team Member
Posts: 2274
Joined: Sun Mar 30, 2014 2:51 pm
x 1239

Re: How to resolve: RuntimeAssertionException: mSubRenderStateList.empty() failed. Sub render states still exists...

Post by paroj »

no, but you have to release the SharedPtrs