Bug 589 - Multiple ORBs cannot be destroyed out of order they were created
Summary: Multiple ORBs cannot be destroyed out of order they were created
Status: RESOLVED
Alias: None
Product: TAO
Classification: Unclassified
Component: ORB (show other bugs)
Version: 1.1
Hardware: x86 Linux
: P3 minor
Assignee: Ossama Othman
URL:
Depends on:
Blocks:
 
Reported: 2000-06-08 16:14 CDT by Ossama Othman
Modified: 2000-06-09 16:02 CDT (History)
0 users

See Also:


Attachments
Simple sample code that demonstrates the problem. (2.88 KB, text/plain)
2000-06-08 20:04 CDT, Ossama Othman
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ossama Othman 2000-06-08 16:14:20 CDT
From Dario Mariani  <dmarian@fi.uba.ar>:

I found that when I use more than one ORB (on the same program), the ORBs must
be destroyed in the same order as they were created.
Comment 1 Ossama Othman 2000-06-08 16:16:20 CDT
Accepted.
Comment 2 Ossama Othman 2000-06-08 20:04:17 CDT
Created attachment 42 [details]
Simple sample code that demonstrates the problem.
Comment 3 Ossama Othman 2000-06-09 16:02:45 CDT
Doug pointed out that the problem wasn't with TAO, but with the application
code.

--------8<--------8<--------8<--------8<--------8<--------8<--------
Doug wrote:
        Did you run Purify or BoundsChecker on your program?  If so,
you will see why it's seg faulting.  It has nothing to do with TAO --
it has to do with the way that your program is designed.  Check out
the following:

>> inline int ORBWorker::svc (void) {
>>   mOrb->run();
>>   return 0;
>> }

This thread is running, yet you then turn around and delete the memory
"out from underneath it" here:

>>   delete ms1;
>>   delete ms2;

My guess is that the following code isn't getting the ORB to return
from the loop and fully shutdown the thread-specific resources in the
MasterServer task before you delete mWorker:

>> MasterServer::~MasterServer() {
>>   mPOA->destroy (true, true);
>>   mRootPOA->destroy (true, true);
>>   mORB->shutdown (false);
>>   mORB->destroy();
>>   delete mWorker;
>> }

Thus, there's a race condition that'll cause seg-faults.

I suggest that you restructure your program to handle this stuff a
different way (which I leave as an "exercise" for you since I don't
know what you're trying to accomplish t a higher-level here!).