Event dispatch in OrbixWeb: single threaded or multi-threaded?

Event dispatch in OrbixWeb: single threaded or multi-threaded?

Post by apm3 » Wed, 28 Nov 2007 22:36:09


I have just found a *** race condition in my java servant which can
only be explained if the CORBA event dispatching in OrbixWeb occurs
using multiple threads. Does it? Can any OrbixWeb/IONA expert comment
please?

This servant is a rewrite of one in C++. In Orbix it looks like by
default the event loop is single threaded but this can be changed with
a small amount of code. I assumed that this default behaviour would
also apply to OrbixWeb. It seems like I am wrong.

Regards,

Andrew Marlow
 
 
 

Event dispatch in OrbixWeb: single threaded or multi-threaded?

Post by Yakov Gerl » Thu, 29 Nov 2007 06:49:01

> I have just found a *** race condition in my java servant which can

That is according the standard unless the servant is registered under
single-threaded POA.
The default threading policy for POA is multithreaded and in Orbix
2000 and Orbix 6.3 it is so. I never worked with OrbixWeb, but I see
no reason to implement something against the standard.
May be you should check the policies of the POA on which your servant
is registered.

 
 
 

Event dispatch in OrbixWeb: single threaded or multi-threaded?

Post by apm3 » Thu, 29 Nov 2007 21:32:45


OrbixWeb 3.0.x is ancient and quite different to the other IONA
products. On page 408 of the OrbixWeb programmers guide in the section
titled "multithreaded servers" it says (and I quote):

Where parallism is not required, there is no need to make a server
multi-threaded.

The way I read this is that by default a server is single-threaded,
you have to write some extra code (e.g using thread filters) to make
it multi-threaded. I have discussed this with an IONA consultant, who
reads this the same way I do. But our OrbixWeb setup seems to
dispatching CORBA requests from more than one thread.

I am using the apache commons logger which reports the thread name in
each logging record. When I log the incoming CORBA request I see two
thread names, one is "main" which I expect since that is where my call
to processEvents is, the other is called "Request Processor". I don't
know where that thread comes from. It's not one of mine.

-Andrew M.
 
 
 

Event dispatch in OrbixWeb: single threaded or multi-threaded?

Post by Mark Woyn » Fri, 30 Nov 2007 01:12:08


Don't confuse event dispatching with POA threading policies. The ROOT
POA is single threaded by default. If you want to have multiple
servants processing messages concurrently, you have to define your own
POA with a multi-threaded policy.

I don't believe the CORBA specs says anything about how an orb
delivers the message to the POA. The processEvents operation is part
of the orb, not the POA. It's possible that the orb itself is using 2
or more threads to process incoming messages: one that reads the
socket and enqueues the message, and one or more other threads that
are associated with the processEvents function. Those thread(s) would
check the message queue, and dispatch the call to the appropriate POA.

Thus, it's possible that multiple threads in the orb layer would block
if multiple calls were send to an object associated with a single-
threaded POA.

Mark
 
 
 

Event dispatch in OrbixWeb: single threaded or multi-threaded?

Post by apm3 » Fri, 30 Nov 2007 20:38:18


I should have mentioned earlier that OrbixWeb 3.0.x is so ancient it
is before the POA was invented. The code in question has no choice but
to use the BOA.