You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by "Marc M. Adkins" <mm...@Doorways.org> on 2003/07/17 22:16:32 UTC

clones and parents

Let's say I want to create a site with five virtual hosts.  I want all of
them to share the basic MP2 stuff, Apache-related modules and so forth.
Then, for Virtual Host 1 (VH1 for short ;) I want to specify a set of
modules unique to VH1.  For VH2-VH4 I want to specify another set of
modules, but the same set for all of those virtual hosts.

So I feel like I want to have two interpreter pools.  I want a parent at the
top-most level (outside of all of the virtual hosts) that loads the basic
stuff.  Then I want a parent and a pool for VH1.  Then I want a parent and a
pool for VH2-VH4 to share.

I'm not clear on how to do this or even if it is possible.  I understand how
the Clone and Parent options work, but they depend on the structure of the
Apache configuration file.  I don't offhand know of a way to group four
virtual hosts into a block so that they can inherit the same parent/pool.

If I were trying to solve this (assuming that it isn't already possible
somehow) I might come up with the concept of named interpreter parent/pools.
Something like:

	<PerlInterpPool VH1>
	  PerlRequire "VH1/startup.pl"
	  ...
	</PerlInterpPool>


	<PerlInterpPool VHX>
	  PerlRequire "VHX/startup.pl"
	  ...
	</PerlInterpPool>

	<VirtualHost VH1>
	  PerlInterpPool	VH1
	</VirtualHost>

	<VirtualHost VH2>
	  PerlInterpPool	VHX
	</VirtualHost>

	...

	<VirtualHost VH5>
	  PerlInterpPool	VHX
	</VirtualHost>

But that's just off the top of my head and probably wrong for any number of
reasons.

Any thoughts?  Or better yet, a way to do this with MP2 already?

mma


Re: clones and parents (bug report)

Posted by Stas Bekman <st...@stason.org>.
Randy Kobes wrote:
[..]
> Just to verify, I also get this with ActivePerl 806,
> Apache/2.0.47, and the current mod_perl cvs version.
> Here's some partial debug information:
> ============================================================
> PERL58! 28083490()
> PERL58! 280648b5()

and what are these two perl calls?

> modperl_perl_destruct(interpreter * 0x0089c794):
>    line 130 + 9 bytes: modperl_perl.c

Perhaps the interpreter struct is corrupt?

> modperl_interp_destroy(modperl_interp_t * 0x008a47c8):
>    line 128 + 12 bytes: modperl_interp.c
> modperl_interp_pool_destroy(void * 0x00869b78):
>    line 184 + 12 bytes: modperl_interp.c
> run_cleanups(cleanup_t * * 0x0089a7a8):
>    line 1980: httpd-2.0.47\srclib\apr\memory\unix\apr_pools.c
> apr_pool_destroy(apr_pool_t * 0x00401585):
>     line 758: httpd-2.0.47\srclib\apr\memory\unix\apr_pools.c
> main(int 0x00401d82, const char * const * 0x00000001) line 619
> APACHE! mainCRTStartup + 227 bytes
> KERNEL32! 77e7eb69()
> ===================================================================
> 


-- 


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


RE: clones and parents (bug report)

Posted by Randy Kobes <ra...@theoryx5.uwinnipeg.ca>.
On Fri, 18 Jul 2003, Marc M. Adkins wrote:
>
> -------------8<---------- Start Bug Report ------------8<----------
> 1. Problem Description:
>
> #   Problem:  When I add PerlOptions +Parent I get a segfault.
> #
> #   Breaks with:
> #       Windows 2000 SP2
> #       Apache  2.0.46
> #       ActiveState Perl 5.8.0 (build 804)
> #       mod_perl 1.99.10dev    (installed using mpinstall.pl,
> #                               re-installed TODAY to be safe)
> #
> # C:\Apache2\conf\parental.conf
> LoadFile                    C:/Perl/bin/perl58.dll
> LoadModule                  perl_module     modules/mod_perl.so
> ###########################################################################
> #
> # Setup for named virtual hosts on port 80:
> #
>
> NameVirtualHost             *:80
> Listen                      80
>
> ###########################################################################
>
> <VirtualHost *:80>
>   ServerName                localhost:80
>   ServerAdmin               admin@localhost
>   DocumentRoot              C:/Apache2/htdocs
>   PerlOptions               +Parent
>   PerlSwitches              -wT
> </VirtualHost>

Just to verify, I also get this with ActivePerl 806,
Apache/2.0.47, and the current mod_perl cvs version.
Here's some partial debug information:
============================================================
PERL58! 28083490()
PERL58! 280648b5()
modperl_perl_destruct(interpreter * 0x0089c794):
   line 130 + 9 bytes: modperl_perl.c
modperl_interp_destroy(modperl_interp_t * 0x008a47c8):
   line 128 + 12 bytes: modperl_interp.c
modperl_interp_pool_destroy(void * 0x00869b78):
   line 184 + 12 bytes: modperl_interp.c
run_cleanups(cleanup_t * * 0x0089a7a8):
   line 1980: httpd-2.0.47\srclib\apr\memory\unix\apr_pools.c
apr_pool_destroy(apr_pool_t * 0x00401585):
    line 758: httpd-2.0.47\srclib\apr\memory\unix\apr_pools.c
main(int 0x00401d82, const char * const * 0x00000001) line 619
APACHE! mainCRTStartup + 227 bytes
KERNEL32! 77e7eb69()
===================================================================

-- 
best regards,
randy kobes

RE: clones and parents (bug report)

Posted by "Marc M. Adkins" <mm...@Doorways.org>.
-------------8<---------- Start Bug Report ------------8<----------
1. Problem Description:

#   Problem:  When I add PerlOptions +Parent I get a segfault.
#
#   Breaks with:
#       Windows 2000 SP2
#       Apache  2.0.46
#       ActiveState Perl 5.8.0 (build 804)
#       mod_perl 1.99.10dev    (installed using mpinstall.pl,
#                               re-installed TODAY to be safe)
#
#   Pops up "Apache.exe - Application Error" box:
#       The instruction at "0x280830ed"
#       referenced memory at "0x00000000".
#       The memory could not be "written".
#
#   After killing the box the command line says:
#       C:\Apache2\bin> apache
#       Starting Apache...
#   and must be killed via <ctrl-C>.  The error log is empty.
#
#   In at least one case the Apache.exe process refused to stop
#   and COULD NOT BE SHUT DOWN VIA TASK MANAGER, requiring reboot.
#   This seems to happen when <ctrl-c> is not invoked immediately
#   after cancelling the message box.

2. Used Components and their Configuration:

*** mod_perl version 1.9910

*** using C:/Perl/site/lib/Apache/BuildConfig.pm
*** Makefile.PL options:
  MP_AP_PREFIX    => \Apache2
  MP_COMPAT_1X    => 1
  MP_GENERATE_XS  => 1
  MP_INST_APACHE2 => 1
  MP_LIBNAME      => mod_perl
  MP_USE_DSO      => 1
  MP_USE_STATIC   => 1


*** \Apache2/bin/Apache.exe -V
Server version: Apache/2.0.46
Server built:   May 27 2003 23:15:42
Server's Module Magic Number: 20020903:3
Architecture:   32-bit
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/winnt"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT="/apache"
 -D SUEXEC_BIN="/apache/bin/suexec"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_ERRORLOG="logs/error.log"
 -D AP_TYPES_CONFIG_FILE="conf/mime.types"
 -D SERVER_CONFIG_FILE="conf/httpd.conf"


*** C:\Perl\bin\perl.exe -V
Summary of my perl5 (revision 5 version 8 subversion 0) configuration:
  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname=''
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    usethreads=undef use5005threads=undef useithreads=define
usemultiplicity=define
    useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
    use64bitint=undef use64bitall=undef uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='cl', ccflags
='-nologo -Gf -W3 -MD -DNDEBUG -O1 -DWIN32 -D_CONSOLE -DNO_STRICT -DHAVE_DES
_FCRYPT  -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DPERL_MSV
CRT_READFIX',
    optimize='-MD -DNDEBUG -O1',
    cppflags='-DWIN32'
    ccversion='', gccversion='', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=10
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='__int64',
lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='link', ldflags
'-nologo -nodefaultlib -release  -libpath:"C:\Perl\lib\CORE"  -machine:x86'
    libpth="C:\Program Files\Microsoft.Net\Odbc.Net\" "C:\Perl\lib\CORE"
    libs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib
msvcrt.lib
    perllibs=  oldnames.lib kernel32.lib user32.lib gdi32.lib winspool.lib
comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib  netapi32.lib
uuid.lib wsock32.lib mpr.lib winmm.lib  version.lib odbc32.lib odbccp32.lib
msvcrt.lib
    libc=msvcrt.lib, so=dll, useshrplib=yes, libperl=perl58.lib
    gnulibc_version='undef'
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ',
ddlflags='-dll -nologo -nodefaultlib -release  -libpath:"C:\Perl\lib\CORE"  
-machine:x86'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES
PERL_IMPLICIT_CONTEXT PERL_IMPLICIT_SYS
  Locally applied patches:
  	ActivePerl Build 804
  Built under MSWin32
  Compiled at Dec  1 2002 23:15:13
  %ENV:
    PERL_LWP_USE_HTTP_10="1"
  @INC:
    C:/Perl/lib
    C:/Perl/site/lib
    .


3. This is the core dump trace: (if you get a core dump):

#   I don't have anything built with debug but even so the stack shows:
#       PERL58.DLL
#       PERL58.DLL
#       MOD_PERL.DLL
#   when I pop into the debugger from the alert panel.

This report was generated by -e on Fri Jul 18 23:48:59 2003 GMT.

-------------8<---------- End Bug Report --------------8<----------

#
# C:\Apache2\conf\parental.conf
#
#   Minimal configuration for breaking PerlOptions +parent.
#   Use Include directive in generic httpd.conf
#
#   There is no startup.pl here, nor much of anything else.
#   I first discovered this issue in a fully populated environment
#   with all of that good stuff.  I removed all of the other goop
#   and it still blows up here.  When I had startup.pl going I
#   added trace statements and startup.pl appeared to execute
#   to completion before the message box appeared.
#
#   Removing PerlOptions +parent makes the crash go away.
#

###########################################################################
#
# Logging more than the default messages:
#

LogLevel                    debug

###########################################################################
#
# Setup mod_perl
#

LoadFile                    C:/Perl/bin/perl58.dll
LoadModule                  perl_module     modules/mod_perl.so

###########################################################################
#
# Setup for named virtual hosts on port 80:
#

NameVirtualHost             *:80
Listen                      80

###########################################################################
#
#
#

<VirtualHost *:80>
  ServerName                localhost:80
  ServerAdmin               admin@localhost
  DocumentRoot              C:/Apache2/htdocs
  PerlOptions               +Parent
  PerlSwitches              -wT
</VirtualHost>


RE: clones and parents

Posted by "Marc M. Adkins" <mm...@Doorways.org>.
> > I never know whether to submit a bug report or not.  Often
> these things turn
> > out to be known issues or I find out it was my own bug at some
> later time...
>
> If you get a segfault, chances are that something is broken, since the sw
> should gracefully handle cases when someone does something wrong
> and not segfault.

OK.  Give me a day or so to double-check by coming up with a minimal test
case.  Which will aid in the debugging effort (one hopes).

mma


Re: clones and parents

Posted by Stas Bekman <st...@stason.org>.
Marc M. Adkins wrote:
>>>So is PerlOptions +Parent working?  Whenever I enable it I get
>>
>>a segfault on
>>
>>>W2K / Ap2.0.46 / mp1.99.10dev.
>>
>>have you submitted a bug report?
>>http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems
> 
> 
> I never know whether to submit a bug report or not.  Often these things turn
> out to be known issues or I find out it was my own bug at some later time...

If you get a segfault, chances are that something is broken, since the sw 
should gracefully handle cases when someone does something wrong and not segfault.



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


RE: clones and parents

Posted by "Marc M. Adkins" <mm...@Doorways.org>.
> > So is PerlOptions +Parent working?  Whenever I enable it I get
> a segfault on
> > W2K / Ap2.0.46 / mp1.99.10dev.
>
> have you submitted a bug report?
> http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems

I never know whether to submit a bug report or not.  Often these things turn
out to be known issues or I find out it was my own bug at some later time...

mma


Re: clones and parents

Posted by Stas Bekman <st...@stason.org>.
Marc M. Adkins wrote:
> No wonder this seemed familiar.  I wrote pretty much the same memo six weeks
> ago.  D'oh!  I've been spending too much time at the keyboard...

I thought I had dejavu ;)

> So is PerlOptions +Parent working?  Whenever I enable it I get a segfault on
> W2K / Ap2.0.46 / mp1.99.10dev.

have you submitted a bug report?
http://perl.apache.org/docs/2.0/user/help/help.html#Reporting_Problems


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


RE: clones and parents

Posted by "Marc M. Adkins" <mm...@Doorways.org>.
No wonder this seemed familiar.  I wrote pretty much the same memo six weeks
ago.  D'oh!  I've been spending too much time at the keyboard...

So is PerlOptions +Parent working?  Whenever I enable it I get a segfault on
W2K / Ap2.0.46 / mp1.99.10dev.

mma

> -----Original Message-----
> From: Marc M. Adkins [mailto:mmadki@Doorways.org]
> Sent: Thursday, July 17, 2003 1:17 PM
> To: modperl@perl.apache.org
> Subject: clones and parents
>
>
> Let's say I want to create a site with five virtual hosts.  I want all of
> them to share the basic MP2 stuff, Apache-related modules and so forth.
> Then, for Virtual Host 1 (VH1 for short ;) I want to specify a set of
> modules unique to VH1.  For VH2-VH4 I want to specify another set of
> modules, but the same set for all of those virtual hosts.
>
> So I feel like I want to have two interpreter pools.  I want a
> parent at the
> top-most level (outside of all of the virtual hosts) that loads the basic
> stuff.  Then I want a parent and a pool for VH1.  Then I want a
> parent and a
> pool for VH2-VH4 to share.
>
> I'm not clear on how to do this or even if it is possible.  I
> understand how
> the Clone and Parent options work, but they depend on the structure of the
> Apache configuration file.  I don't offhand know of a way to group four
> virtual hosts into a block so that they can inherit the same parent/pool.
>
> If I were trying to solve this (assuming that it isn't already possible
> somehow) I might come up with the concept of named interpreter
> parent/pools.
> Something like:
>
> 	<PerlInterpPool VH1>
> 	  PerlRequire "VH1/startup.pl"
> 	  ...
> 	</PerlInterpPool>
>
>
> 	<PerlInterpPool VHX>
> 	  PerlRequire "VHX/startup.pl"
> 	  ...
> 	</PerlInterpPool>
>
> 	<VirtualHost VH1>
> 	  PerlInterpPool	VH1
> 	</VirtualHost>
>
> 	<VirtualHost VH2>
> 	  PerlInterpPool	VHX
> 	</VirtualHost>
>
> 	...
>
> 	<VirtualHost VH5>
> 	  PerlInterpPool	VHX
> 	</VirtualHost>
>
> But that's just off the top of my head and probably wrong for any
> number of
> reasons.
>
> Any thoughts?  Or better yet, a way to do this with MP2 already?
>
> mma
>
>