[omniORB] omni and Apache
Sai-Lai Lo
S.Lo@uk.research.att.com
10 Jan 2001 11:53:49 +0000
It looks like my reply to Hany has not been CC to the list. So here it goes
again:
In one of our projects we have an apache module written to use omniORB.
The important point is when to call ORB_init.
In our apache module, the module dispatch structure looks like this:
static int initialised = 0;
// Spirit request content handler.
static int spirit_handler(request_rec *r)
{
....
if (!initialised)
{
initialised = 1;
int argc = 0;
char** argv = NULL;
CORBA::ORB_init(argc,argv,"omniORB3");
}
....
}
// Here is the list of content handlers for the module.
static const handler_rec spirit_handlers[] =
{
{"spirit-handler", spirit_handler},
{NULL}
};
// We have no command directives for this module.
static const command_rec spirit_cmds[] =
{
{NULL}
};
// And here is the list of callback routines.
module spirit_module =
{
STANDARD_MODULE_STUFF,
NULL, // Initializer.
NULL, // Per-directory config.
NULL, // Directory config merger.
NULL, // Server config.
NULL, // Server config merger.
spirit_cmds, // Command table.
spirit_handlers, // Handler list.
NULL, // Filename-to-URI translation.
NULL, // Validate userid.
NULL, // Validate userid for this URI.
NULL, // Host address access.
NULL, // Check mime types.
NULL, // Any last minute fixes.
NULL, // Log.
#if MODULE_MAGIC_NUMBER >= 19970103
NULL, // Header parser.
#if MODULE_MAGIC_NUMBER >= 19970719
NULL, // Process initializer.
#if MODULE_MAGIC_NUMBER >= 19970728
NULL, // Process cleanup.
#if MODULE_MAGIC_NUMBER >= 19970902
NULL // Immediate handler.
#endif
#endif
#endif
#endif
};
Notice that ORB_init is called in the handler itself. That means it will be
called by the worker process that actually serve the http request. After
ORB_init is called, the ORB will spawn a few internal threads. If the
process call fork() soon afterwards, things will almost certainly not
work. By putting ORB_init in the handler, it is certain that the process
calling it will not be forking another process to do the work.
Regards,
Sai-Lai
>>>>> John Hedges writes:
> Hi Hany
> I believe there are problems with Apache and pthreads.
> Try a single threaded orb for your module (mico definately works and orbit looks like it ought to).
> Cheers
> John
> On Thursday, January 04, 2001 12:29 PM, Hany Greiss [SMTP:hany@peac.com] wrote:
>>
>>
>> Hello again,
>>
>> Just to follow up on my previous e-mail regarding hanging on the call
>> to ORB_init from within an Apache module. I came across a suggestion to
>> insert tracing within the argc/argv parameters. When I did this the only
>>
>> output I received was,
>>
>> omniORB: strand Ripper: start.
>>
>> It appears to hang at this point. Any ideas?
>>
>> Thanks,
>>
>> Hany
>> hany@portalsphere.com
>>
>>
>>
--
Sai-Lai Lo S.Lo@uk.research.att.com
AT&T Laboratories Cambridge WWW: http://www.uk.research.att.com
24a Trumpington Street Tel: +44 1223 343000
Cambridge CB2 1QA Fax: +44 1223 313542
ENGLAND