MovableObject crash

Discussion area about developing with Ogre-Next (2.1, 2.2 and beyond)


Post Reply
Gdlk
Halfling
Posts: 53
Joined: Mon Dec 05, 2011 9:43 pm
x 1

MovableObject crash

Post by Gdlk »

Hi!

I have a random bug in my app (probably memory bug), so I am trying to debug it with Application Verifier and gflags. With the verifier/gflags activate, when the ogre start rendering, it crash in the line:

OGRE_PREFETCH_NTA( (const char*)(objData.mParents[i+OGRE_PREFETCH_SLOT_DISTANCE]) );

of the method MovableObject::updateAllBounds, when is called by SceneManager::updateAllBoundsThread.

I believe the crash in that line means I am modifying some scene node when the scene graph is being updated, isn't it?. Any idea or tip about how find the source of the problem? and is it reliable the application verifier? (I was developing in linux without problems, recently I must change to windows and, in the window migration, the bug show up)

Regards!!
Gdlk
Halfling
Posts: 53
Joined: Mon Dec 05, 2011 9:43 pm
x 1

Re: MovableObject crash

Post by Gdlk »

Nobody =( ?

Now the crash happens always in the first render frame, and print by terminal 16 DummyNodes before crash in that line (the print is just before the crash line)

Any idea?
zxz
Gremlin
Posts: 184
Joined: Sat Apr 16, 2016 9:25 pm
x 19

Re: MovableObject crash

Post by zxz »

Your quoted code appears to be doing a prefetch of the next parent pointer elements. My guess is that it prefetches elements past the end of the array at the end of the loop, thus triggering your memory access validator. It should be harmless.

You could build Ogre with the prefetch disabled, and you should get further in your debugging.
Gdlk
Halfling
Posts: 53
Joined: Mon Dec 05, 2011 9:43 pm
x 1

Re: MovableObject crash

Post by Gdlk »

zxz wrote:Your quoted code appears to be doing a prefetch of the next parent pointer elements. My guess is that it prefetches elements past the end of the array at the end of the loop, thus triggering your memory access validator. It should be harmless.

You could build Ogre with the prefetch disabled, and you should get further in your debugging.
Ok!, thanks!, I will try that.

Only for curiosity, why that line use 'i' index instead of 'j' index? (unlike the next prefetchs in the same loop). If the 'i' index is the right one, would not be better if it was out of the loop?
User avatar
dark_sylinc
OGRE Team Member
OGRE Team Member
Posts: 5298
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 1279
Contact:

Re: MovableObject crash

Post by dark_sylinc »

I took a close look and this was a bug that was fixed in 8a1e52d4674f21143bfce6a0678ae7917c67b828.

We were prefetching 'i+OGRE_PREFETCH_SLOT_DISTANCE' instead of prefetching 'OGRE_PREFETCH_SLOT_DISTANCE', thus the distance would grow and grow and grow until eventually we're prefetching an address that is very far outside the valid range.
PREFETCHNTA won't crash if you access an invalid pointer but the address must not fault. I guess the reason this didn't come up earlier is because it never faulted; but Application Verifier purposedly mangled the memory allocation so that it faults.
Gdlk
Halfling
Posts: 53
Joined: Mon Dec 05, 2011 9:43 pm
x 1

Re: MovableObject crash

Post by Gdlk »

Great! =D

Thanks!!!!
Post Reply