Re: early perl startup in vhost on win32

2003-10-24 Thread Steve Hay
Stas Bekman wrote:

Steve Hay wrote:

Here's a minimal conf file which still fails when running "perl 
t/TEST -start" (or even "C:\apache2\bin\Apache.exe -t -d 
C:/Temp/modperl-2.0/t -f C:/Temp/modperl-2.0/t/conf/httpd.conf 
-DAPACHE2 -DPERL_USEITHREADS"):

=
LoadModule   perl_module 
C:\Temp\modperl-2.0\src\modules\perl\mod_perl.so
ServerName   localhost:8529
Listen   8529
ServerRoot   C:/Temp/modperl-2.0/t
DocumentRoot C:/Temp/modperl-2.0/t/htdocs
LogLevel debug
Listen   8530

 PerlOptions  +Parent
 
   1;
 



The problem with this config, is that you don't handle @INC to use the 
fresh build. So it loads stuff from the previously installed 
system-wide mod_perl. Probably it doesn't affect the outcome, but 
please set it right (e.g. nuke the preinstalled things so it won't 
load them). You need something like this:


 PerlSwitches -I/home/stas/apache.org/mp2-vhost/blib/lib/Apache2
 PerlSwitches -I/home/stas/apache.org/mp2-vhost/blib/arch/Apache2
 PerlSwitches -I/home/stas/apache.org/mp2-vhost/blib/lib
 PerlSwitches -I/home/stas/apache.org/mp2-vhost/blib/arch
 PerlSwitches -I/home/stas/apache.org/mp2-vhost/lib
 PerlOptions  +Parent
 
   1;
 

In any case it works fine on linux. 
Yes, it was using pre-installed stuff.  Having deleted all the 
preinstalled stuff it then complained it couldn't load various things.  
I added a few @INC paths like this:

=
LoadModule   perl_module C:\Temp\modperl-2.0\src\modules\perl\mod_perl.so
ServerName   localhost:8529
Listen   8529
ServerRoot   C:/Temp/modperl-2.0/t
DocumentRoot C:/Temp/modperl-2.0/t/htdocs
LogLevel debug
Listen   8530

 PerlSwitches -IC:/Temp/modperl-2.0/Apache-Test/lib
 PerlSwitches -IC:/Temp/modperl-2.0/blib/lib
 PerlSwitches -IC:/Temp/modperl-2.0/blib/arch
 PerlOptions  +Parent
 
   1;
 

=
It then stopped complaining that it couldn't find things, and 
"Apache.exe -t ..." now says syntax OK, but trying to start the server 
still fails as before.



modperl_mgv.c:264: package Apache::PerlSections not defined, 
attempting to load

Free to wrong pool 262770 not 925938.


The problems is this: perl uses dTHX; calls in some functions which 
disregards the passed context and retrieves the globally stored 
context. Which means that *every* time we select an interpreter, we 
must call PERL_SET_CONTEXT() and pass to it the parent interpreter of 
the currently used pool :(

In particular for your and mine segfaults the Perl_safesysfree() call 
is the one that uses dTHX and gets the wrong context at times, and 
then it crashes. 
:(

I just saw your post on p5p, so I'll watch that to see what people say.



This short conf file is OK if I remove the "+Parent" line.

I can also "fix" it by removing the ... section, but 
trying the same trick with the full vhost test setup (commenting out 
the appropriate add_config() call from t/htdocs/vhost/startup.pl) 
doesn't fix that :(

I notice that the ... section in that startup.pl file 
is commented "this used to have problems on win32".  Looks like it 
still does?


Probably it just moved to a different place. Most likely it's the same 
problem, I have explained above.

I also notice that the short conf file gives this syntax error if I 
change the  to :

   Syntax error on line 10 of C:/Temp/modperl-2.0/t/conf/httpd.conf:
directive missing closing '>'


You need the current httpd cvs for  to work. Unfortunately it 
seems that  Phillipe's fix won't make it to 2.0.48 (which should be 
released shortly), but only 2.0.49 :( 
Oh, right.  I'll have to start using CVS Apache2 as well, I think.

- Steve

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: early perl startup in vhost on win32

2003-10-24 Thread Steve Hay
Stas Bekman wrote:

Stas Bekman wrote:

Steve Hay wrote:

modperl_mgv.c:264: package Apache::PerlSections not defined, 
attempting to load

Free to wrong pool 262770 not 925938.


The problems is this: perl uses dTHX; calls in some functions which 
disregards the passed context and retrieves the globally stored 
context. Which means that *every* time we select an interpreter, we 
must call PERL_SET_CONTEXT() and pass to it the parent interpreter of 
the currently used pool :(

In particular for your and mine segfaults the Perl_safesysfree() call 
is the one that uses dTHX and gets the wrong context at times, and 
then it crashes.


I think if you build perl without using perl's malloc this particular 
segfault will go away. Certainly it's not a good solution. 
No, that's not true - my Perl is built without Perl's malloc anyway :(

It isn't possible to build mp2 using a Perl that doesn't have ithreads, 
and on Win32 at least (I don't know if this limitation exists on other 
OS's too or not?) you can't use Perl's malloc with ithreads!  Perl's 
win32/Makefile says of the PERL_MALLOC option (equivalent to 
-Dusemymalloc): "Currently, this cannot be enabled if you ask for 
USE_IMP_SYS".  Hence I have:

   C:\Temp\modperl-2.0>perl -V:usemymalloc
   usemymalloc='n';
I've never liked that, nor understood why it is.  I would rather use 
Perl's malloc if possible; I do with my current mp1 setup which doesn't 
require ithreads.

- Steve

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: early perl startup in vhost on win32

2003-10-24 Thread Steve Hay
Stas Bekman wrote:

Steve Hay wrote:

Stas Bekman wrote:

Stas Bekman wrote:

This and your trace proves my suspicion that my solution just 
happened to work for the particular setup you had the crush with. 
But I think we are on the right track. We get the crash when the 
wrong perl is set as the current context. I will try to remove my 
recent solution and try to see why modperl_cmd_modules doesn't use 
the correct perl. This is the place where the problem comes from.




Please try this patch: 


Trying your patch with the short conf file that I posted a few 
minutes ago, the -t test now passes "syntax OK", but the server still 
won't start.

Running "C:\apache2\bin\Apache.exe -d C:/Temp/modperl-2.0/t -f 
C:/Temp/modperl-2.0/t/conf/httpd.conf -DAPACHE2 -DPERL_USEITHREADS" 
still crashes at the same "Free to wrong pool" place in the code, 
although its much earlier and I don't see that error message in the 
console now.  Here's the stack trace:

=
VMem::Free(void * 0x009fa3ac) line 208 + 3 bytes
CPerlHost::Free(void * 0x009fa3ac) line 59 + 34 bytes
PerlMemFree(IPerlMem * 0x00262434, void * 0x009fa3ac) line 302
Perl_safesysfree(void * 0x009fa3ac) line 143 + 26 bytes
Perl_sv_clear(interpreter * 0x002643cc, sv * 0x002653c4) line 5198 + 
13 bytes
Perl_sv_free(interpreter * 0x002643cc, sv * 0x002653c4) line 5342 + 
13 bytes
Perl_free_tmps(interpreter * 0x002643cc) line 189 + 13 bytes
perl_destruct(interpreter * 0x002643cc) line 456 + 23 bytes
modperl_perl_destruct(interpreter * 0x002643cc) line 144 + 9 bytes


So here we get perl_destruct calling some functions that rely on the 
right context. I don't get this problem, but please try this patch:

[...]
Still doesn't work :(

The backtrace and MOD_PERL_TRACE are the same as before (except for a 
few extra lines in the MOD_PERL_TRACE relating to the new "PerlSwitches 
-I..." that I've added to this minimal conf file).




Using the full vhost test setup I do still see the "Free to wrong 
pool" message as before, but the stack trace is still shorter.

The full vhost setup also still fails as before.  The backtrace is again 
the same.  I've attached the MOD_PERL_TRACE output since it includes a 
couple of new lines (from the extra trace call that your patch added).

Just to prove my assumptions I'd try to temporarely patch it as:

Index: src/modules/perl/modperl_util.c
===
RCS file: /home/cvs/modperl-2.0/src/modules/perl/modperl_util.c,v
retrieving revision 1.55
diff -u -r1.55 modperl_util.c
--- src/modules/perl/modperl_util.c9 Oct 2003 23:56:52 -1.55
+++ src/modules/perl/modperl_util.c23 Oct 2003 23:34:32 -
@@ -4,6 +4,8 @@
 {
 SV *sv;
+PERL_SET_CONTEXT(my_perl);
+
 dSP;
 PUSHSTACKi(PERLSI_REQUIRE);
 PUTBACK; 
I get errors compiling that:

modperl_util.c(7) : error C2275: 'SV' : illegal use of this type as an 
expression
   C:\apache2\perl5\lib\CORE\perl.h(1772) : see declaration of 'SV'
modperl_util.c(7) : error C2065: 'sp' : undeclared identifier
modperl_util.c(7) : error C2100: illegal indirection
modperl_util.c(8) : error C2113: pointer can only be subtracted from 
another pointer

It compiles if I put the new PERL_SET_CONTEXT(my_perl) call after the 
dSP.  But it makes no difference either to the short or the full conf file.

- Steve


trace.txt.gz
Description: GNU Zip compressed data
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Bug Report mod_perl

2003-10-24 Thread mkunkel
-8<-- Start Bug Report 8<--
1. Problem Description:

I can't start my Apache2 (Debian Testing) with mod_perl

Apache without mod_perl works fine.

Error Message:
Syntax error on line 1 of /etc/apache2/mods-enabled/perl.load:
Cannot load /usr/lib/apache2/modules/mod_perl.so into server: 
/usr/lib/apache2/modules/mod_perl.so: undefined symbol: PerlIOBase_binmode

2. Used Components and their Configuration:

*** mod_perl version 1.9910

*** using lib/Apache/BuildConfig.pm
*** Makefile.PL options:
  MP_APXS => /usr/bin/apxs2
  MP_COMPAT_1X=> 1
  MP_GENERATE_XS  => 1
  MP_INST_APACHE2 => 1
  MP_LIBNAME  => mod_perl
  MP_USE_DSO  => 1
  MP_USE_STATIC   => 1


*** /usr/sbin/apache2 -V
Server version: Apache/2.0.47
Server built:   Jul 15 2003 14:07:14
Server's Module Magic Number: 20020903:4
Architecture:   32-bit
Server compiled with
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D HTTPD_ROOT=""
 -D SUEXEC_BIN="/usr/lib/apache2/suexec2"
 -D DEFAULT_PIDLOG="/var/run/httpd.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="/etc/apache2/mime.types"
 -D SERVER_CONFIG_FILE="/etc/apache2/apache2.conf"


*** /usr/bin/perl -V
Summary of my perl5 (revision 5.0 version 8 subversion 0) configuration:
  Platform:
osname=linux, osvers=2.4.20-xfs+ti1211, archname=i386-linux-thread-multi
uname='linux kosh 2.4.20-xfs+ti1211 #1 sat nov 30 19:19:08 est 2002 i686 gnulinux '
config_args='-Dusethreads -Duselargefiles -Dccflags=-DDEBIAN -Dcccdlflags=-fPIC 
-Darchname=i386-linux -Dprefix=/usr -Dprivlib=/usr/share/perl/5.8.0 
-Darchlib=/usr/lib/perl/5.8.0 -Dven
dorprefix=/usr -Dvendorlib=/usr/share/perl5 -Dvendorarch=/usr/lib/perl5 
-Dsiteprefix=/usr/local -Dsitelib=/usr/local/share/perl/5.8.0 
-Dsitearch=/usr/local/lib/perl/5.8.0 -Dman1dir=/usr/s
hare/man/man1 -Dman3dir=/usr/share/man/man3 -Dman1ext=1 -Dman3ext=3perl 
-Dpager=/usr/bin/sensible-pager -Uafs -Ud_csh -Uusesfio -Uusenm -Duseshrplib 
-Dlibperl=libperl.so.5.8.0 -Dd_dosuid
-des'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define 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='cc', ccflags ='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing 
-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O3',
cppflags='-D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing'
ccversion='', gccversion='3.3 (Debian)', gccosandvers=''
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=4, prototype=define
  Linker and Libraries:
ld='cc', ldflags =' -L/usr/local/lib'
libpth=/usr/local/lib /lib /usr/lib
libs=-lgdbm -ldb -ldl -lm -lpthread -lc -lcrypt
perllibs=-ldl -lm -lpthread -lc -lcrypt
libc=/lib/libc-2.3.1.so, so=so, useshrplib=true, libperl=libperl.so.5.8.0
gnulibc_version='2.3.1'
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-rdynamic'
cccdlflags='-fPIC', lddlflags='-shared -L/usr/local/lib'


Characteristics of this binary (from libperl):
  Compile-time options: MULTIPLICITY USE_ITHREADS USE_LARGE_FILES PERL_IMPLICIT_CONTEXT
  Built under linux
  Compiled at Jun  5 2003 23:33:07
  %ENV:
PERL_LWP_USE_HTTP_10="1"
  @INC:
/etc/perl
/usr/local/lib/perl/5.8.0
/usr/local/share/perl/5.8.0
/usr/lib/perl5
/usr/share/perl5
/usr/lib/perl/5.8.0
/usr/share/perl/5.8.0
/usr/local/lib/site_perl
.


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

  [CORE TRACE COMES HERE]

This report was generated by /usr/bin/mp2bug on Wed Oct 22 13:01:52 2003 GMT.

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





-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]