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

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

From: Stas Bekman
Subject: Re: Apache2/Modperl2 fails to preload Win32::OLE at server startup
Date: 03:43 on 30 Nov 2004
Jan Dubois wrote:
> On Mon, 29 Nov 2004, Stas Bekman wrote:
> 
>>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?
> 
> 
> Is CLONE running inside the new *thread* ? It is not good enough to run
> it in the correct Perl interpreter; you must call CoInitialize() inside
> the thread that is going to make COM/OLE calls. Otherwise COM will not
> operate from that thread. It needs to associate the *thread* with a
> specific apartment for synchronization purposes first.
> 
> Sorry, that is the only thing I can think of right now. I can't remember
> how CLONE is being called exactly.

If you just call perl_clone it runs in the new perl context, but inside 
the same thread. At least on Unix. Under ithreads.pm it probably starts a 
new thread first (but I'm not sure). Under modperl 2, there is no 1:1 
relationship between interpreters and apache threads

so that means that it's out of question that Win32::OLE can be used at 
all, right? I suppose Thierry was just lucky to get the thing working by 
loading at request time, and most likely under a bit of stress testing 
it'll show the same problems.

        -- 
        __________________________________________________________________
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 03:43 on 30 Nov 2004

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