[osg-users] Strange error only in debug mode

72 views
Skip to first unread message

daniele argiolas

unread,
Jun 8, 2010, 6:28:53 AM6/8/10
to osg-...@lists.openscenegraph.org
Hi,
I've a program with some updateCallbacks of some objects.
When I run in in Release mode it doesn't generate any errors but when I try it in Debug mode randomly, without a real sense, this error appears:

First-chance exception at 0x102b6ef5 (osg65-osgd.dll) in ARGAME.exe: 0xC0000005: Access violation reading location 0xfeeefeee.
Unhandled exception at 0x102b6ef5 (osg65-osgd.dll) in ARGAME.exe: 0xC0000005: Access violation reading location 0xfeeefeee.

And then it breaks my program into void NodeCallback::traverse(Node* node,NodeVisitor* nv) function.

I tried different ways but only in Debug mode it generates this error, sometimes immediatly, sometimes after some minutes.

Do you know why it is generated only in debug mode? And what error is it?

Thank you very much
Daniele

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=28685#28685

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Alberto Luaces

unread,
Jun 8, 2010, 6:50:41 AM6/8/10
to osg-...@lists.openscenegraph.org
Hi Daniele,

"daniele argiolas" writes:

> Do you know why it is generated only in debug mode? And what error is it?

Yes. It's a pattern from VC. It means "deallocated memory". See

http://www.nobugs.org/developer/win32/debug_crt_heap.html


--
Alberto

daniele argiolas

unread,
Jun 9, 2010, 6:11:47 AM6/9/10
to osg-...@lists.openscenegraph.org
Thank you, I understand but how can I disable this VC errors?
Are an OSG bug?

Another error that breaks also in NodeCallback function is
"Access violation reading location 0xcdcdcdcd."

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=28726#28726

Alberto Luaces

unread,
Jun 9, 2010, 6:48:19 AM6/9/10
to osg-...@lists.openscenegraph.org
"daniele argiolas" writes:

> Thank you, I understand but how can I disable this VC errors?
> Are an OSG bug?

You'd better not do that, because they point errors in *your* code. OSG
is accesing a node that you might have deleted from the heap. It could
work in Release mode because freed memory might not be overwritten and
by pure luck the data stays there. But that is undefined behaviour, so
the system can allocate new memory over that piece of data
anytime. Debug mode makes this clear erasing former data so it's evident
what is happening.

> Another error that breaks also in NodeCallback function is
> "Access violation reading location 0xcdcdcdcd."

Again, you have some bugs to remove in your code.

--
Alberto

daniele argiolas

unread,
Jun 11, 2010, 6:58:51 AM6/11/10
to osg-...@lists.openscenegraph.org
Thank you. I don't understand where is the error because in my program I simply call sometimes a removeUpdateCallback(nc) then an addUpdateCallback(nc) over my object, where nc is an osgAnimationCallback* object. I never delete my object then it's very strange this output.

Can anybody help me?

thanks

This is call stack:
osg65-osgd.dll!osg::NodeCallback::traverse(osg::Node * node=0x01aba720, osg::NodeVisitor * nv=0x019f5f68) Line 21 + 0x2d bytes C++
osg65-osgd.dll!osg::AnimationPathCallback::operator()(osg::Node * node=0x01aba720, osg::NodeVisitor * nv=0x019f5f68) Line 251 C++
osg65-osgUtild.dll!osgUtil::UpdateVisitor::handle_callbacks_and_traverse(osg::Node & node={...}) Line 85 + 0x1c bytes C++
osg65-osgUtild.dll!osgUtil::UpdateVisitor::apply(osg::Transform & node={...}) Line 57 + 0x1a bytes C++
osg65-osgd.dll!osg::NodeVisitor::apply(osg::MatrixTransform & node={...}) Line 136 + 0x13 bytes C++
osg65-osgd.dll!osg::MatrixTransform::accept(osg::NodeVisitor & nv={...}) Line 37 + 0x41 bytes C++
osg65-osgd.dll!osg::Group::traverse(osg::NodeVisitor & nv={...}) Line 62 + 0x25 bytes C++
osg65-osgd.dll!osg::NodeVisitor::traverse(osg::Node & node={...}) Line 191 + 0x1c bytes C++
osg65-osgUtild.dll!osgUtil::UpdateVisitor::handle_callbacks_and_traverse(osg::Node & node={...}) Line 86 + 0x25 bytes C++
osg65-osgUtild.dll!osgUtil::UpdateVisitor::apply(osg::Group & node={...}) Line 56 + 0x1a bytes C++
osg65-osgd.dll!osg::Group::accept(osg::NodeVisitor & nv={...}) Line 38 + 0x41 bytes C++
osg65-osgViewerd.dll!osgViewer::Scene::updateSceneGraph(osg::NodeVisitor & updateVisitor={...}) Line 87 + 0x1e bytes C++
osg65-osgViewerd.dll!osgViewer::Viewer::updateTraversal() Line 882 C++
osg65-osgViewerd.dll!osgViewer::ViewerBase::frame(double simulationTime=1.7976931348623157e+308) Line 608 + 0xf bytes C++
osg65-osgViewerd.dll!osgViewer::ViewerBase::run() Line 581 + 0x1b bytes C++
osg65-osgViewerd.dll!osgViewer::Viewer::run() Line 322 C++
ARGAME.exe!main() Line 141 + 0xf bytes C++
ARGAME.exe!__tmainCRTStartup() Line 586 + 0x19 bytes C
ARGAME.exe!mainCRTStartup() Line 403 C

------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=28820#28820

Alberto Luaces

unread,
Jun 11, 2010, 7:34:54 AM6/11/10
to osg-...@lists.openscenegraph.org
"daniele argiolas" writes:

> Thank you. I don't understand where is the error because in my program I simply call sometimes a removeUpdateCallback(nc) then an addUpdateCallback(nc) over my object, where nc is an osgAnimationCallback* object. I never delete my object then it's very strange this output.

Then it could be possible that you are removing the callback while OSG
is in its update phase. Where are you calling removeUpdateCallback()?

--
Alberto

Raymond de Vries

unread,
Jun 11, 2010, 7:41:33 AM6/11/10
to OpenSceneGraph Users
Hi,

Fyi, you can also remove a callback by using NULL, the ref counting
would clean it up then. Would that help?

Cheers
Raymond

On 6/11/2010 1:34 PM, Alberto Luaces wrote:
> "daniele argiolas" writes:
>
>
>> Thank you. I don't understand where is the error because in my program I simply call sometimes a removeUpdateCallback(nc) then an addUpdateCallback(nc) over my object, where nc is an osgAnimationCallback* object. I never delete my object then it's very strange this output.
>>
> Then it could be possible that you are removing the callback while OSG
> is in its update phase. Where are you calling removeUpdateCallback()?
>
>

_______________________________________________

daniele argiolas

unread,
Jun 14, 2010, 5:22:05 AM6/14/10
to osg-...@lists.openscenegraph.org
Hi, that's not a problem, I had the same also before insert the removecallback.

My program use the reactivision tracking system (with TUIO server) and implements an augmented reality software.
In osg I receive position of marker taken by reactivision and for every position I call an update callback for update object's position.
Then that's impossible that I call an update callback over an object that's not exists. I never destroy objects.

Alberto Luaces wrote:
> "daniele argiolas" writes:
>
>
> > Thank you. I don't understand where is the error because in my program I simply call sometimes a removeUpdateCallback(nc) then an addUpdateCallback(nc) over my object, where nc is an osgAnimationCallback* object. I never delete my object then it's very strange this output.
> >
>
> Then it could be possible that you are removing the callback while OSG
> is in its update phase. Where are you calling removeUpdateCallback()?
>

> --
> Alberto
>
> _______________________________________________
> osg-users mailing list
>

> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
> ------------------
> Post generated by Mail2Forum


------------------
Read this topic online here:

http://forum.openscenegraph.org/viewtopic.php?p=28871#28871

Alberto Luaces

unread,
Jun 14, 2010, 5:30:25 AM6/14/10
to osg-...@lists.openscenegraph.org
Ok, then you'll have to start from the beginning, climbing up the stack
in order to know what was that pointer pointing to before the crash.

If you know the type of object that is the one that is being freed, you
can watch for the addresses were they are stored at the beginning of
your program, then let it run until it crashes to see what object is the
culprit. After that, you can track it in a new run in order to see where
the problem appears.
--
Alberto

_______________________________________________
osg-users mailing list
osg-...@lists.openscenegraph.org
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply all
Reply to author
Forward
0 new messages