-------------8<---------- Start Bug Report ------------8<---------- 1. Problem Description: --------------------- I'm trying to run some ModPerl::Registry and some mod_cgi scripts on the same server. The problem is that sometimes the mod_cgi scripts get no input for POST requests (STDIN is closed?). I'm able to reproduce it consistently like this:
1. restart apache. 2. do a GET request to a ModPerl::Registry script (with input). 3. do a POST request to a mod_cgi script (with input). --> If the POST is served by the same child as the GET from step 2, the mod_cgi script doesn't see any input. I can continue to re-POST to the mod_cgi script and repeat the problem. (However, if I POST first to the mod_perl script, the mod_cgi script works fine.) Details: --------------------- No errors show up in the apache log. My script produces an error page because it got no input, and then everything goes on. If I then POST to the mod_perl script, the child is ok from then on -- the mod_cgi POSTS start working. --------------------- This seems to happen not only on server startup, but whenever a new child starts and serves first a mod_perl GET and then a mod_cgi POST. --------------------- I compiled and loaded mod_logio so that I could verify that apache is getting the POST data. It is. Here's my log format: LogFormat "%P %t \"%r\" %>s %b %U %I %O" joe1 Here's the result: 24184 [25/May/2005:17:02:05 -0400] "GET /MRcgi-mp/MRtest.pl?var=1&var2=2 HTTP/1.1" 200 631 /MRcgi-mp/MRtest.pl 523 886 24184 [25/May/2005:17:02:08 -0400] "POST /MRcgi/MRtest2.pl HTTP/1.1" 200 631 /MRcgi/MRtest2.pl 610 885 (The above POST shows 610 bytes of input, but the script never sees it.) --------------------- I've reproduced this on multiple apaches on one machine (solaris) and one apache on a linux. The details below are for the latest version (apache 2.0.54 and mod_perl 2.0), which I just installed today. The other configuration I've used is apache 2.0.50 and mod_perl 1.999.22, with identical results. --------------------- I've tried both CGI.pm and manually reading STDIN: read(STDIN,$in,$ENV{'CONTENT_LENGTH'}); neither works. (empty $in from read, empty hash from CGI's params method) --------------------- TEST SCRIPT: --------------------- I first saw this problem in a few larger scripts, but I've boiled it down to a simple test script. I have two copies of the script named MRtest.pl and MRtest2.pl -- one for mod_perl and one for mod_cgi. The only part that needs explanation is the commented out BEGIN block. On my solaris apache, if I remove the last letter of the line ("e"), everything works. If I add it back, it fails again. Consistently. The same trick doesn't work on my linux -- the error always occurs. ---------------------------- #!/usr/footprints_perl/bin/perl use strict; use warnings; #BEGIN #{ # print "Content-type: text/html\n\ndebugging (b-e-g-i-n)...<BR>\n"; # x the #} print "Content-type: text/html\n\ndebugging (main)...<BR>\n"; print "<HTML><BODY>\n"; use CGI; my $query = new CGI; my @params = $query->param(); print "recieved " . scalar(@params) . " CGI parameters.<BR>\n"; print " <FORM NAME=test1 METHOD=POST ACTION=/MRcgi-mp/MRtest.pl> <INPUT TYPE=HIDDEN NAME=INPUT1 VALUE=1> <INPUT TYPE=HIDDEN NAME=INPUT2 VALUE=2> <INPUT TYPE=SUBMIT VALUE=\"Submit post data to MRtest.pl\"> </FORM> <P> <FORM NAME=test1 METHOD=POST ACTION=/MRcgi/MRtest2.pl> <INPUT TYPE=HIDDEN NAME=INPUT1 VALUE=1> <INPUT TYPE=HIDDEN NAME=INPUT2 VALUE=2> <INPUT TYPE=SUBMIT VALUE=\"Submit post data to MRtest2.pl\"> </FORM> <P> <a href=\"/MRcgi-mp/MRtest.pl?var=1&var2=2\">MRtest.pl (get)</a> <P> <a href=\"/MRcgi/MRtest2.pl?var=1&var2=2\">MRtest2.pl (get)</a> "; print "</BODY></HTML>\n"; --------------------- Also, here's the relevant part of my httpd.conf: ScriptAlias /MRcgi/ "/export/home/footprints_2018/cgi/" Alias /MRcgi-mp/ "/export/home/footprints_2018/cgi-mp/" PerlRequire /export/home/footprints_2018/etc/mod_perl_startup.pl <Files ~ "MR(login|entrancePage|debugEnv|quickHelp|homepage|directSearch|details|checkBack|search_page|directEdit|logsAlert|register_command|register_page|spellCheck|ABreghome|ABregdetails|ABregsearch_page|test)\.m?pl$"> SetHandler perl-script PerlResponseHandler ModPerl::Registry Options +ExecCGI PerlOptions +ParseHeaders PerlInitHandler Apache2::Reload </Files> --------------------- And here's the startup file that the httpd.conf loads: #!/usr/footprints_perl/bin/perl -- use ModPerl::Registry; use ModPerl::Util (); use Apache2::RequestRec (); use APR::Pool (); use warnings; use lib '/export/home/footprints_2018/cgi'; # This is the only place to set ENV vars that seems to carry through to system commands. $ENV{'PATH'} = join ':', '.', '/export/home/footprints_2018/bin', $ENV{'PATH'} unless $ENV{'PATH'} =~ /footprints_2018\/bin/; # set a global var so that scripts know they're running under mod_perl: $FP::mod_perl = 1; --------------------- Thanks for any help you can give! Please let me know if I can help by providing more info or in any other way. -Joe 2. Used Components and their Configuration: *** mod_perl version 2.000000 *** using /usr/footprints_perl/lib/site_perl/5.8.1/sun4-solaris/Apache2/BuildConfig.pm *** Makefile.PL options: MP_APR_LIB => aprext MP_AP_PREFIX => /usr/local/apache2 MP_COMPAT_1X => 1 MP_GENERATE_XS => 1 MP_LIBNAME => mod_perl MP_USE_DSO => 1 *** The httpd binary was not found (Here's the result of my manually running ./httpd -V) virgo(SCM 2018) 3583$ ./httpd -V Server version: Apache/2.0.54 Server built: May 25 2005 16:13:47 Server's Module Magic Number: 20020903:9 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_FCNTL_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="/usr/local/apache2" -D SUEXEC_BIN="/usr/local/apache2/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_LOCKFILE="logs/accept.lock" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" *** (apr|apu)-config linking info -L/usr/local/apache2/lib -laprutil-0 -lgdbm -lexpat -liconv -L/usr/local/apache2/lib -lapr-0 -lsendfile -lrt -lm -lsocket -lnsl -lresolv -lpthread -ldl *** /usr/footprints_perl/bin/perl -V Summary of my perl5 (revision 5.0 version 8 subversion 1) configuration: Platform: osname=solaris, osvers=2.8, archname=sun4-solaris uname='sunos virgo 5.8 generic_108528-19 sun4u sparc sunw,sun-blade-1000 ' config_args='-Dcc=gcc' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=undef use64bitall=undef uselongdouble=undef usemymalloc=n, bincompat5005=undef Compiler: cc='gcc', ccflags ='-fno-strict-aliasing -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64', optimize='-O', cppflags='-fno-strict-aliasing -I/usr/local/include' ccversion='', gccversion='2.95.3 20010315 (release)', gccosandvers='solaris2.8' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='gcc', ldflags =' -L/usr/local/lib ' libpth=/usr/local/lib /usr/lib /usr/ccs/lib libs=-lsocket -lnsl -ldl -lm -lc perllibs=-lsocket -lnsl -ldl -lm -lc libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -z ignore -z lazyload -z combreloc' cccdlflags='-fPIC', lddlflags=' -G -z ignore -z lazyload -z combreloc -L/usr/local/lib' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under solaris Compiled at Oct 10 2003 15:07:29 %ENV: PERL_LWP_USE_HTTP_10="1" @INC: /usr/footprints_perl/lib/5.8.1/sun4-solaris /usr/footprints_perl/lib/5.8.1 /usr/footprints_perl/lib/site_perl/5.8.1/sun4-solaris /usr/footprints_perl/lib/site_perl/5.8.1 /usr/footprints_perl/lib/site_perl . *** Packages of interest status: Apache2 : - Apache2::Request : - CGI : 3.08 ExtUtils::MakeMaker: 6.17 LWP : 5.69 mod_perl : 1.9914 mod_perl2 : 2.000000 3. This is the core dump trace: (if you get a core dump): [CORE TRACE COMES HERE] This report was generated by /usr/footprints_perl/bin/mp2bug on Wed May 25 20:40:19 2005 GMT. -------------8<---------- End Bug Report --------------8<---------- Note: Complete the rest of the details and post this bug report to modperl <at> perl.apache.org. To subscribe to the list send an empty email to [EMAIL PROTECTED]