RE: More multi-threading questions...




-----Original Message-----
From: Justin Schoeman [mailto:justin@expertron.co.za]
Sent: Tuesday, September 09, 2003 9:39 AM
To: Michael Meeks
Cc: orbit-list@gnome.org
Subject: Re: More multi-threading questions...


Michael Meeks wrote:
> Hi Justin,
> 
> On Mon, 2003-09-08 at 14:05, Justin Schoeman wrote:
> 
>>The shutdown logic is basically copied from the orbit examples in the 
>>orbit documentation - calling shutdown from a signal handler.
> 
> 	Right;
> 
>>It seems the problem stems more from using corba clients and corba 
>>servers in a single application than from the multi-threading issues. 
>>The server code terminates on a signal (which calls CORBA_ORB_shutdown). 
>>After that, the app tries to do a corba client call to unbind on the 
>>name service -> it is during this client call that the server thread
aborts.
>>
>>It seems that there is only one orb, irrespective of how many 
>>CORBA_ORB_init calls you make... Multiple shutdowns and inits seem to 
>>break things!
> 
> 	Yes - this is perhaps one of the most sucky things about the CORBA
> spec. that I'm aware of ;-)
> 
>>Is it possible that I could mail you a cut-down version of my app for 
>>some advice?  It is a total of about 10k? It is heavily based on the 
>>echo example, just hacked into generalised handlers for my application...
> 
> 	Please do post a link to the mailing list; please CC the mailing
list
> always. Ultimately your questions are unlikely to be as stupid as the
> dumbest people out there :-) and thus the answers are interesting to
> other people; also I can't respond to all the questions myself.

http://www.expertron.co.za/justin/corba_test.tar.bz2

It is a bit ugly, but is made to make it easy to port our existing 
services to a CORBA infrastructure.

The actual code is in:
corba_test/corba/echo_test

>>Alternatively, do you have some advice/examples on using clients and 
>>servers in a single app? Should you always use only one orb reference? 
>>If so, how can you terminate the server thread (if you can no longer use 
>>CORBA_ORB_shutdown)?
> 
> 	'The server thread' ? I'm slightly unsure what you mean by that;
when
> all CORBA stuff is finished, and you no longer want to respond to
> requests, do a single CORBA_ORB_shutdown; but it's better to do a
> CORBA_ORB_destroy per CORBA_ORB_init ( I think ) - although there is
> some oddness there - I would personally do 1 init, and 1 destroy in the
> same thread before and after executing the code I'm interested in.

Sorry, my mistake, I meant the server main loop.  At the moment I exit 
the main loop by calling CORBA_ORB_shutdown from a signal handler. 
Unfortunately, this means that I can no longer use the CORBA client to 
unregister from the name service (unless I re-initialise CORBA, which I 
suppose is an option).  Is there another way to terminate the CORBA 
server main loop (without terminating the ORB).

> 	Ultimately - do you need multi-threading anyway ? what is the
> application ? most people get by with re-enterant processing.

This is for a 'universal' vending platform.  Some stock types can take a 
while for purchases to complete, so the purchases need to take place in 
separate threads...

----

The solution as I see it now:
1) Modify code to use only 1 CORBA_ORB_init.
2) Modify server code to exit server main loop without terminating the ORB.

Thanks again,
-justin

PS: Bonus marks to anybody who can find the memory leak in the test app! 
  It seems to leak about 4 bytes for every object instantiate/destroy 
cycle (in single or multi-threaded mode).

_______________________________________________
orbit-list mailing list
orbit-list@gnome.org
http://mail.gnome.org/mailman/listinfo/orbit-list



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