RE: graceful mulit-threaded shutdown



Thanks, I went ahead and did this and it works great for getting me out of
the running thread, but I still am getting a seg fault.  When it finally
crashed during shutdown, the backtrace is:

#0  0x401ce23f in ORBit_POA_setup_root () from /usr/lib/libORBit-2.so.0
#1  0xbffff690 in ?? ()
#2  0x401cd219 in ORBit_POA_is_inuse () from /usr/lib/libORBit-2.so.0
#3  0x40246ee6 in g_hash_table_foreach () from /usr/lib/libglib-2.0.so.0
#4  0x401cd317 in ORBit_POA_deactivate () from /usr/lib/libORBit-2.so.0
#5  0x401cd081 in ORBit_POA_is_inuse () from /usr/lib/libORBit-2.so.0
#6  0x401cfd24 in PortableServer_POA_destroy () from
/usr/lib/libORBit-2.so.0
#7  0x401bd03f in CORBA_ORB_shutdown () from /usr/lib/libORBit-2.so.0
#8  0x401bd0f9 in CORBA_ORB_destroy () from /usr/lib/libORBit-2.so.0
#9  0x401bbab1 in ORBit_ORB_start_servers () from /usr/lib/libORBit-2.so.0
#10 0x4202ac92 in exit () from /lib/i686/libc.so.6
#11 0x420158ff in __libc_start_main () from /lib/i686/libc.so.6
(gdb)

the poa doesn't seem to want to shutdown due to remaining refrence.  during
the lifecycle of my app I create the orb, a server, and a client.  On
shutdown I clean up the client first:
	CORBA_Object_release(client, ev);
I don't release the orb yet since the server still is around.

I then call 
	g_main_loop_quit(loop);

In my "run" method, after g_main_loop_run (loop) returns I call:
    CORBA_Object_release(servant, ev);
if that doesn't raise an exception (it doesn't appear to) and if the orb is
not null, I call:
        CORBA_ORB_destroy (orb, ev);

I'm not calling the shutdown directly as the destroy should handle this (if
i try, I get the old must shutdown from main thread error).  I exit the run
method and complete the shutting down of the rest of my app, it hangs for a
second or two and then seg faults!

Am I not properly cleaning the client references? I'm wading throught the
source, but would appreciate any insight.

thanks,
Tyler
    

-----Original Message-----
From: Jan Kratochvil [mailto:lace@jankratochvil.net]
Sent: Monday, November 10, 2003 5:45 AM
To: Tyler Kohn
Cc: 'orbit-list@gnome.org'
Subject: Re: graceful mulit-threaded shutdown


Hi,

On Fri, 07 Nov 2003 23:12:33 +0100, Tyler Kohn wrote:
...
> When my app shuts down, a child thread goes through all of my loaded
> components and has them shut themselves down gracefully.  My orbit2 server
> is a child of one of these components.  The problem is that the thread
that
> started the server is blocking and when I try to shutdown the server from
> another thread I get:
> 
> ** ERROR **: Must shutdown ORB from main thread
> aborting...

I think the solution from Michael Meeks should apply even to you:


On Wed, 05 Nov 2003 13:08:02 +0100, Michael Meeks wrote:
...
> replace all calls to CORBA_ORB_run with something like:
>
>       ctxt = g_main_context_default ();
>       loop = g_main_loop_new (ctxt, TRUE);
>       g_main_loop_run (loop);

While you can use
	g_main_loop_quit(loop);

from 'another thread' (initiating the framework shutdown) and finally:

^	ctxt = g_main_context_default ();
^	loop = g_main_loop_new (ctxt, TRUE);
^	g_main_loop_run (loop);
->	CORBA_ORB_destroy (...);



Regards,
Lace

-- 
Jan Kratochvil; Captive: free r/w NTFS Filesystem;
http://www.jankratochvil.net/



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]