You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stephan Wacker <St...@web.de> on 2004/08/08 20:47:11 UTC
URLs with path_info component cause segment violation in ModPerl::Registry and ModPerl::PerlRun
Greetings,
I already searched Google and the list archives but could not find
any explanation for my problem; therefore...
My website uses the PATH_INFO feature of CGI URLs, i.e. the URLs
look like
http://my.server/some/path/cgi/my_script.pl/context/info
and "/context/info" should be visible in $query->path_info()
[[where $query is a CGI object]]. This works fine with Apache and
Perl.
After installing and configuring mod_perl, all requests of my Perl
scripts caused a segment violation in the Apache handler. I was
then able to reproduce the problem with only a copy of
cgi-bin/printenv in perl/printenv.pl [[any other Perl CGI script
would do]].
The software versions are
Apache/2.0.50 (Gentoo/Linux)
mod_perl/1.99_11
Perl/v5.8.4
[[This info is taken from the output of printenv.pl without a
path_info component - just to prove that the script is found and
would normally work. When accessed via a ScriptAlias and an
external Perl process, an optional path_info string shows up in
the PATH_INFO environment variable.]]
This is the configuration section using ModPerl::Registry or
ModPerl::PerlRun for different Locations. The LocationMatch will
match URLs with or without path info.
----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----
<IfModule mod_alias.c>
# [...]
<IfModule mod_perl.c>
#Provide two aliases to the same cgi-bin directory,
#to see the effects of the 2 different mod_perl modes
#for Apache::Registry Mode
Alias /perl/ /var/www/localhost/perl/
#for Apache::Perlrun Mode
Alias /cgi-perl/ /var/www/localhost/perl/
</IfModule>
</IfModule>
<IfModule mod_perl.c>
#set Apache::Registry Mode for /perl Alias
<LocationMatch "^/perl/.*\.pl">
SetHandler perl-script
PerlResponseHandler ModPerl::Registry
Options -Indexes ExecCGI
PerlSendHeader On
</LocationMatch>
#set Apache::PerlRun Mode for /cgi-perl Alias
<LocationMatch "^/cgi-perl/.*\.pl">
SetHandler perl-script
PerlResponseHandler ModPerl::PerlRun
PerlOptions +ParseHeaders
Options -Indexes ExecCGI
PerlSendHeader On
</LocationMatch>
</IfModule>
----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----
This is what I got from a debugger session when I requested the
URL http://localhost/perl/printenv.pl/xyz
----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----
dwalin tmp # gdb /usr/sbin/apache2
GNU gdb 6.0
[...]
This GDB was configured as "i686-pc-linux-gnu"...Using host
libthread_db library "/lib/libthread_db.so.1".
(gdb) run -DONE_PROCESS -DNO_DETACH -D PHP4 -D PERL
-f /etc/apache2/conf/my_master.conf
Starting program: /usr/sbin/apache2 -DONE_PROCESS -DNO_DETACH -D
PHP4 -D PERL -f /etc/apache2/conf/my_master.conf
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
Detaching after fork from child process 30713.
Detaching [...].
Program received signal SIGSEGV, Segmentation fault.
apr_thread_mutex_lock (mutex=0xe4e1c0) at thread_mutex.c:71
71 thread_mutex.c: No such file or directory.
in thread_mutex.c
(gdb) where
#0 apr_thread_mutex_lock (mutex=0xe4e1c0) at thread_mutex.c:71
#1 0x40192d8c in apr_file_read (thefile=0x819a1e0, buf=0x80d6a68,
nbytes=0xbffff028) at readwrite.c:47
#2 0x40457593 in ?? ()
#3 0x0819a1e0 in ?? ()
#4 0x080d6a68 in ?? ()
#5 0xbffff028 in ?? ()
#6 0x080dead8 in ?? ()
#7 0xbffff078 in ?? ()
#8 0x0819a1e0 in ?? ()
#9 0x0000010c in ?? ()
#10 0x405b2363 in ?? ()
#11 0x08232db0 in ?? ()
#12 0x405b3cf0 in ?? ()
#13 0xbffff078 in ?? ()
#14 0x405b1a85 in ?? ()
#15 0x08302d50 in ?? ()
(gdb) p *mutex
Cannot access memory at address 0xe4e1c0
(gdb) up
#1 0x40192d8c in apr_file_read (thefile=0x819a1e0, buf=0x80d6a68,
nbytes=0xbffff028) at readwrite.c:47
47 readwrite.c: No such file or directory.
in readwrite.c
(gdb) p *thefile
$1 = {pool = 0x80a0168, filedes = 0,
fname = 0x81751f8 "/usr/lib/apache2/conf/my_local.conf",
flags = 15,
eof_hit = 135897424, is_pipe = 135899352,
timeout = 583688357628870656,
buffered = 135054568, blocking = 4, ungetchar = 1,
buffer = 0x819a2a0 "ð×\031\b", bufpos = 135911552,
dataRead = 135898776,
direction = 300000000, filePtr = 0, thlock = 0xe4e1c0}
(gdb)
----8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----
Although I had all programs (Perl, Apache, mod_perl) compiled with
debug information, debug info was only available for the last two
stack frames. :-(
To me this looks like a recycled "thefile" object that had once
been used to read my base config file [[my_local.conf includes
the distribution's apache2.conf and commonapache2.conf files plus
additional files for my website]]. But most of the other entries
are garbage, causing the segment violation when thefile->thlock
is dereferenced in apr_thread_mutex_lock().
Another interesting detail: When I start another debugger session
and use the other method (ModPerl::PerlRun instead of
ModPerl::Registry), I get *exactly* the same results, i.e. the
arguments to apr_file_read() and the contents of *thefile are
exactly the same as shown above. This seems rather unusual for
objects which are probably created dynamically on the heap!?
Does anybody successfully use PATH_INFO with Apache2 and mod_perl?
Sorry for the rather lengthy posting, but I wanted to provide as
much detail as possible.
Thanks in advance for any hints
Stephan
--
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
Re: URLs with path_info component cause segment violation in ModPerl::Registry
and ModPerl::PerlRun
Posted by Stas Bekman <st...@stason.org>.
Stephan Wacker wrote:
> Greetings,
>
> I already searched Google and the list archives but could not find
> any explanation for my problem; therefore...
>
>
> My website uses the PATH_INFO feature of CGI URLs, i.e. the URLs
> look like
> http://my.server/some/path/cgi/my_script.pl/context/info
> and "/context/info" should be visible in $query->path_info()
> [[where $query is a CGI object]]. This works fine with Apache and
> Perl.
>
>
> After installing and configuring mod_perl, all requests of my Perl
> scripts caused a segment violation in the Apache handler. I was
> then able to reproduce the problem with only a copy of
> cgi-bin/printenv in perl/printenv.pl [[any other Perl CGI script
> would do]].
>
> The software versions are
> Apache/2.0.50 (Gentoo/Linux)
> mod_perl/1.99_11
> Perl/v5.8.4
Stephan, please install the latest mod_perl version which is 1.99_14. If
the problem persists, please submit a complete bug report as explained
here: http://perl.apache.org/bugs/. Thank you.
--
__________________________________________________________________
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
--
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