Archived
This forum has been archived. Please start a new discussion on GitHub.
Assertion failure in GCShared in 1.3?
brian
in Help Center
Hello Again,
I just made the Ice 1.3 installation, non-optimized, and got this failure when my Ice::Application object destructs.
Assertion failed: num == 1, GCShared.cpp, line 69
I did not make 1.2 non-optimized so I did not get this assertion, but it was core dumping upon exit, so maybe this problem is in 1.2 as well.
Anybody know what I might be doing wrong? I noticed there was a bug fix for 1.3 mentioned in the CHANGES file for interrupts on an Ice::Application, but I am not sending any signals nor interrupting, I just allow the application to run to the end of my run() method.
Any ideas?
Brian
I just made the Ice 1.3 installation, non-optimized, and got this failure when my Ice::Application object destructs.
Assertion failed: num == 1, GCShared.cpp, line 69
I did not make 1.2 non-optimized so I did not get this assertion, but it was core dumping upon exit, so maybe this problem is in 1.2 as well.
Anybody know what I might be doing wrong? I noticed there was a bug fix for 1.3 mentioned in the CHANGES file for interrupts on an Ice::Application, but I am not sending any signals nor interrupting, I just allow the application to run to the end of my run() method.
Any ideas?
Brian
0
Comments
-
-
For now, simply comment out the assertion. That will get you off the hook.
What would help me is if you could send me the state of all threads. I suspect that another thread is also destroying (or has just recently destroyed) something that derives from Ice::Object. Also, if you have this happening reliably (that is, on every run, not just occasionally), I'd really like to see your code because that's probably the only way to work out what is going wrong. If you could put together a test case that shows the failure, this would help enormously.
I'm not sure whether this is due to a bug in your code or in our code but, either way, it would be good to know why this is happening, so we can come up with a way to prevent this problem in future.
Cheers,
Michi.0 -
Michi,
After extensive investigation I think I know what I was doing wrong. I was creating a servant, adding it to an adapter, and then explicitly calling the delete function on the servant. When I commented the delete out, the assert went away and I noticed that the destructor of the servant was still being called when Ice::Application exits -- I guess when it calls deactivate on all its adapters. (I did not glom this functionality from the manual.) So I guess the reference count of the servant was being decremented too much.
I've attached the stack trace from where the destructor of our servant, ItsOmsProxyFacade, is called.
Does this all make sense to you?
Brian0 -
Originally posted by brian
Michi,
After extensive investigation I think I know what I was doing wrong. I was creating a servant, adding it to an adapter, and then explicitly calling the delete function on the servant.
Right. Never call delete on a servant. It's guaranteed to mess up the reference counts. (The whole point of using reference counts is so you don't have to bother with remembering to call delete.)When I commented the delete out, the assert went away and I noticed that the destructor of the servant was still being called when Ice::Application exits -- I guess when it calls deactivate on all its adapters. (I did not glom this functionality from the manual.) So I guess the reference count of the servant was being decremented too much.
Right. The relevant explanations are on page 256 of the Ice manual. A general explanation of smart pointers starts on page 176.
Cheers,
Michi.0
