SharedPtr assert since r8787 (iPhone Patch?)

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
User avatar
aguru
Goblin
Posts: 236
Joined: Tue Feb 26, 2008 5:48 pm
x 3

SharedPtr assert since r8787 (iPhone Patch?)

Post by aguru »

Some of the addon libs (for example Caelum) don't work since trunk revision 8787 (8786 is working fine). I have trouble debugging on my linux system but here is a call stack:

Code: Select all

#0 0x7f85d7782645	raise() (/lib/libc.so.6:??)
#1 0x7f85d7783b63	abort() (/lib/libc.so.6:??)
#2 0x7f85d777b6d9	__assert_fail() (/lib/libc.so.6:??)
#3 0x7f85d89f5bea	Ogre::PrefabFactory::createSphere(mesh=0x7f85d91c1a08) (ogre/OgreMain/include/OgreSharedPtr.h:158)
#4 0x7f85d89f5ca8	Ogre::PrefabFactory::createPrefab(mesh=0x7f85d91c1a08) (ogre/OgreMain/src/OgrePrefabFactory.cpp:54)
#5 0x7f85d8997358	Ogre::MeshManager::loadResource(this=0x7f85d919b8d8, res=0x6abf) (ogre/OgreMain/src/OgreMeshManager.cpp:393)
#6 0x7f85d8a288c0	Ogre::Resource::load(this=0x7f85d91c1a08, background=<value optimized out>) (ogre/OgreMain/src/OgreResource.cpp:157)
#7 0x7f85d899397f	Ogre::MeshManager::createPrefabSphere(this=0x7f85d919b8d8) (ogre/OgreMain/src/OgreMeshManager.cpp:375)
#8 0x7f85d8a4a3c1	Ogre::Root::oneTimePostWindowInit(this=0x7f85d91944a8) (ogre/OgreMain/src/OgreRoot.cpp:1223)
#9 0x7f85d8a4da9f	Ogre::Root::initialise(this=0x7f85d91944a8, autoCreateWindow=true, windowTitle=@0x7fffbbe8cad0, customCapabilitiesConfig=@0x77e0b0) (ogre/OgreMain/src/OgreRoot.cpp:606)
The exact assert error is:

Code: Select all

CaelumDemo: ogre/OgreMain/include/OgreSharedPtr.h:158: T* Ogre::SharedPtr<T>::operator->() const [with T = Ogre::HardwareIndexBuffer]: Assertion `pRep' failed.
Any help would be great :)
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: SharedPtr assert since r8787 (iPhone Patch?)

Post by masterfalcon »

I had a feeling that there might be some fallout from all the changes I made, especially regarding uninitialized variables. I'm going to check in a patch that has a chance of fixing it. I've never used Caelum so let me know if you still have trouble.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: SharedPtr assert since r8787 (iPhone Patch?)

Post by sinbad »

Neither OgrePrefabFactory.cpp or OgreSharedPtr.h changed in revision 8787 though. Uninitialised vars fixes looked fine to me, and I haven't had any issues so far.

The interesting thing is that SharedPtr is not being used in those lines in PrefabFactory, it's a raw Mesh*. Therefore there's no reason at all for it to be in OgreSharedPtr.h. I'm betting on an unclean build or a failure to install new binaries correctly.
User avatar
aguru
Goblin
Posts: 236
Joined: Tue Feb 26, 2008 5:48 pm
x 3

Re: SharedPtr assert since r8787 (iPhone Patch?)

Post by aguru »

I just uninstalled and deleted both my ogre and caelum directories, checked out latest ogre and caelum svn and rebuild everything. I'm 100% sure there are no remains from a previous build left on my system (linux x64).

What I'm not so sure about is the stack trace I posted above, it from my own project, not from the Caelum demo itself. Probably you guys should just ignore it when debugging this. The caelum problem is actually pretty easy to reproduce, just get caelum svn from https://caelum.svn.sf.net/svnroot/caelum/trunk/Caelum and build the library :)

There are other people having the same problem at the moment (ogitor devs) here: http://www.ogre3d.org/addonforums/viewt ... 21&t=10589
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: SharedPtr assert since r8787 (iPhone Patch?)

Post by jacmoe »

We (or rather: I) had some issues with Ogre::FileInfoListPtr corrupting memory after updating from rev. 8786 to HEAD.
Not really sure what the problem is as I didn't look hard into it. Reverted to last know good 8786.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
cdleonard
Goblin
Posts: 266
Joined: Thu May 31, 2007 9:45 am

Re: SharedPtr assert since r8787 (iPhone Patch?)

Post by cdleonard »

I believe this to be related to buildsettings.h; this section of the patch:

Code: Select all

-# Read contents of the OgreConfig.h file
-file(READ "${OGRE_SOURCE_DIR}/OgreMain/include/OgreConfig.h" OGRE_CONFIG_H)
-# add HAVE_OGRE_BUILDSETTINGS_H preprocessor define
-file(WRITE ${OGRE_BINARY_DIR}/include/OgreConfig.h "#define HAVE_OGRE_BUILDSETTINGS_H\n${OGRE_CONFIG_H}")
-install(FILES ${OGRE_BINARY_DIR}/include/OgreConfig.h DESTINATION include/OGRE)
+# Install OgreConfig.h file
+# This used to add HAVE_OGRE_BUILDSETTINGS_H to the top, which is a duplicate of adding -DHAVE_OGRE_BUILDSETTINGS_H
+install(FILES ${OGRE_SOURCE_DIR}/OgreMain/include/OgreConfig.h DESTINATION include/OGRE)
Writing a new OgreConfig.h is not redundant because when building stuff from the outside HAVE_OGRE_BUILDSETTINGS_H might not be defined. It's certainly not defined on Linux via pkg-config.

I my guess is that this causes Ogre to be build with THREAD_SUPPORT=2 and a mutex in each SharedPtr; while external stuff is built with THREAD_SUPPORT=0 and a smaller SharedPtr. This results in memory corruption.

Reverting those lines makes this work for me; and is probably better than making sure everybody has HAVE_OGRE_BUILDSETTINGS_H defined. It's doable on linux with pkg-config; but very confusing for windows users.
User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19269
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 66
Contact:

Re: SharedPtr assert since r8787 (iPhone Patch?)

Post by sinbad »

Good catch, thanks mate. I'll revert that change.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: SharedPtr assert since r8787 (iPhone Patch?)

Post by jacmoe »

Thanks a lot for that. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
aguru
Goblin
Posts: 236
Joined: Tue Feb 26, 2008 5:48 pm
x 3

Re: SharedPtr assert since r8787 (iPhone Patch?)

Post by aguru »

Indeed, thanks guys! :)
User avatar
masterfalcon
OGRE Team Member
OGRE Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126
Contact:

Re: SharedPtr assert since r8787 (iPhone Patch?)

Post by masterfalcon »

D'oh!

So sorry guys. I'd still consider myself a beginner with CMake. I apologize for any lost time and headaches that I have caused for you. :oops:
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: SharedPtr assert since r8787 (iPhone Patch?)

Post by jacmoe »

Considering the massive amount of changes you did in short time, you're doing a great job. :)
The is Ogre unstable. We have been warned.
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
User avatar
jacmoe
OGRE Retired Moderator
OGRE Retired Moderator
Posts: 20570
Joined: Thu Jan 22, 2004 10:13 am
Location: Denmark
x 179
Contact:

Re: SharedPtr assert since r8787 (iPhone Patch?)

Post by jacmoe »

That fixed the issue. :)
/* Less noise. More signal. */
Ogitor Scenebuilder - powered by Ogre, presented by Qt, fueled by Passion.
OgreAddons - the Ogre code suppository.
Post Reply