Re: Apache2/Modperl2 fails to preload Win32::OLE at server startup

[prev] [thread] [next] [Date index for 2004/11/29]

From: Stas Bekman
Subject: Re: Apache2/Modperl2 fails to preload Win32::OLE at server startup
Date: 15:56 on 29 Nov 2004
Jan, do you have any idea why the CLONE trick doesn't work? CLONE is 
running inside the newly-clonned perl, so thread-safety shouldn't get on 
the way, no?

Thierry Valentin wrote:
> Hello,
> 
> Here is the startup script modified as you recommended:
> (I replaced the call to warn by Apache->server->log->debug because warn 
> does not log anything - at least under win32)
> 
> =================================
> # mod_perl startup script
> use Apache2 ();
> use ModPerl::Util ();
> use Apache::RequestRec ();
> use Apache::RequestIO ();
> use Apache::RequestUtil ();
> use Apache::ServerRec ();
> use Apache::ServerUtil ();
> use Apache::Connection ();
> use Apache::Log ();
> use Apache::Const -compile => ':common';
> use APR::Const -compile => ':common';
> use APR::Table ();
> use Apache::compat ();
> use ModPerl::Registry ();
> 
> # Special function called when a new interpreter is started
> sub Startup::CLONE {
>     Apache->server->log->debug("CLONE is running");
>     require Win32::OLE;
> }
> 
> 1;
> =================================
> 
> This still fails to startup with the same MS Apache failure dialog
> The only line I get in the error log is the following:
> 
> [Mon Nov 29 11:11:44 2004] [debug] mod_perl_startup.pl(22): CLONE is 
> running
> 
> 
> If I comment the "require Win32::OLE" server starts up correctly and 
> error log contains the following lines:
> 
> ...
> [Mon Nov 29 11:11:44 2004] [debug] mod_perl_startup.pl(22): CLONE is 
> running
> [Mon Nov 29 11:28:38 2004] [debug] mod_perl_startup.pl(22): CLONE is 
> running
> [Mon Nov 29 11:30:33 2004] [debug] mod_perl_startup.pl(19): CLONE is 
> running
> [Mon Nov 29 11:30:33 2004] [debug] mod_perl_startup.pl(19): CLONE is 
> running
> [Mon Nov 29 11:30:33 2004] [debug] mod_perl_startup.pl(19): CLONE is 
> running
> [Mon Nov 29 11:30:34 2004] [debug] mod_perl_startup.pl(19): CLONE is 
> running
> [Mon Nov 29 11:30:34 2004] [debug] mod_perl_startup.pl(19): CLONE is 
> running
> [Mon Nov 29 11:30:35 2004] [debug] mod_perl_startup.pl(19): CLONE is 
> running
> [Mon Nov 29 11:30:35 2004] [notice] Parent: Created child process 3492
> [Mon Nov 29 11:30:35 2004] [debug] mpm_winnt.c(479): Parent: Sent the 
> scoreboard to the child
> [Mon Nov 29 11:30:35 2004] [debug] mod_perl_startup.pl(19): CLONE is 
> running
> [Mon Nov 29 11:30:35 2004] [debug] mod_perl_startup.pl(19): CLONE is 
> running
> [Mon Nov 29 11:30:35 2004] [debug] mod_perl_startup.pl(19): CLONE is 
> running
> [Mon Nov 29 11:30:36 2004] [debug] mod_perl_startup.pl(19): CLONE is 
> running
> [Mon Nov 29 11:30:36 2004] [debug] mod_perl_startup.pl(19): CLONE is 
> running
> [Mon Nov 29 11:30:37 2004] [debug] mod_perl_startup.pl(19): CLONE is 
> running
> [Mon Nov 29 11:30:37 2004] [notice] Child 3492: Child process is running
> [Mon Nov 29 11:30:37 2004] [info] Parent: Duplicating socket 188 and 
> sending it to child process 3492
> ...
> 
> 
> 
> Stas Bekman wrote:
> 
>> Thierry Valentin wrote:
>>
>>> Hello,
>>> I've tried the My::HappyWorkaround::CLONE trick...
>>> But sorry, same punishment as before:
>>> => Apache refuses to start + MS Failure Dialog.
>>
>>
>>
>> Does this function get to run at all? Add:
>>
>>   warn "CLONE is running";
>>
>> inside this function and check the logs/console while starting the 
>> server.
>>
>> I'd expect that it should work, since CLONE is run inside the cloned 
>> interprters.
>>
>> Of course you need to remove any other instances of:
>>
>>   use Win32::OLE
>>
>> and inside CLONE it must be require().
>> [...]
>>
>>>> There is one possible solution that will work for you though. Try to 
>>>> add to startup.pl the following code:
>>>>
>>>> sub My::HappyWorkaround::CLONE {
>>>>    require Win32::OLE;
>>>> }
>>>>
>>>> CLONE is a special function which is called when a new interpreter 
>>>> is started. Think of it as ChildInit but for the interpreter.
>>
>>
>>
>>
>>
> 
> 


        -- 
        __________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@xxxxxx.xxx http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com

-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

(message missing)

Re: Apache2/Modperl2 fails to preload Win32::OLE at server startup
Stas Bekman 15:56 on 29 Nov 2004

Generated at 11:26 on 21 Dec 2004 by mariachi v0.52