Solved

TAO Corba client crash

Posted on 2011-02-15
4
589 Views
Last Modified: 2012-05-11
Hi,
I wrote a simple client/server based on the chat example in the tao/examples/simple/chat directory, using ACE-6.0.0 win32.
The client seems to run fine, but when main ends as it's running its destructors it crashes on an access violation at

Line 33 in leader_follower.cpp

  if ( this->orb_core_->gui_resource_factory () )
    this->orb_core_->gui_resource_factory ()->reclaim_reactor (this->reactor_);

I'm not sure if its relevant but my client access is done through a secondary class that's instantiated from a dll. So the orb init code resides in the dll too.
This is my basic initialization code in the dll:

        int argc;
        ACE_TCHAR** argv = CommandLineToArgvA(GetCommandLine(), &argc);
       
        orb_ = CORBA::ORB_init (argc, argv);
       
        // Open the file for reading.
        ACE_HANDLE f_handle = ACE_OS::open (ior_filename, 0);

        if (f_handle != ACE_INVALID_HANDLE) {

            ACE_Read_Buffer ior_buffer (f_handle);
            char *data = ior_buffer.read ();

            if (data != 0) {
                CORBA::Object_var server_object =
                    orb_->string_to_object (data);
                __symbols = Symbols::_narrow (server_object.in ());
                if (!CORBA::is_nil (__symbols.in ())) __order_sync_init_successful=true;
            }
            ior_buffer.alloc ()->free (data);
            ACE_OS::close (f_handle);
        }
       
and this is the final code:
        orb_ ->shutdown();
0
Comment
Question by:longtree
  • 2
  • 2
4 Comments
 
LVL 12

Expert Comment

by:trinitrotoluene
ID: 34930463
this shouldn't be too difficult to isolate since its in the destructor it most definitely is because something has already been released or invalidated or maybe not even initialized.

if you have access to a debugger place a breakpoint before the place where it is crashing and check which pointer is going NULL


otherwise do the following. check my code snippet below. I'm just checking for NULL so that you can isolate the problem further




[i] if ( this->orb_core_->gui_resource_factory () )
    this->orb_core_->gui_resource_factory ()->reclaim_reactor (this->reactor_);
[/i]

//modify your code as below to check for null

if(this){
if(this->core!=NULL){
if(this->orb_core_->gui_resource_factory () != NULL){
this->orb_core_->gui_resource_factory ()->reclaim_reactor (this->reactor_);
}
}
}

    
[/i]

Open in new window

0
 
LVL 12

Expert Comment

by:trinitrotoluene
ID: 34930469
ofcourse if you don't have a debugger then insert a few log statements to help you with the flow and the crash location
0
 

Accepted Solution

by:
longtree earned 0 total points
ID: 34930933
I figured it out. I declared the CORBA object as static and I guess at program termination it was being destroyed after the orb was. Solution was to switch
from a _var type to a _ptr type and then the destructor didn't do anything.
0
 

Author Closing Comment

by:longtree
ID: 34959281
I figured it out myself and that was the reason.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
c++ syntax question 9 44
Export Table to CSV - Access to CSV - using python 18 100
SUM 2 INTEGER ARRAYS INTO 1 10 93
Path to Python 9 107
Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now