Internal Server Error output - but no error

2007-12-29 Thread Kate Yoak

I am using mp2bug format for the message.  Hope, that's ok!


=
-8<-- Start Bug Report 8<--
1. Problem Description:


I have just upgraded to apache2/modperl2 (bug report with specific  
version info is below) and I am getting the strangest behavior. The  
barebones content handler:


sub handler{
return 200;
}

Generates the proper headers:
HTTP/1.1 200 OK
Date: Sun, 30 Dec 2007 03:12:03 GMT
Server: Apache/2.2.6 (Unix) mod_perl/2.0.3 Perl/v5.8.8
Content-Length: 497
Content-Type: text/html; charset=iso-8859-1

But then adds a 500 error html to the output:


200 OK

OK
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
Please contact the server administrator,
 [EMAIL PROTECTED] and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.
More information about this error may be available
in the server error log.



I say, "adds" because I have verified that if any content is output  
by the handler, the 500 doc is appended.


There is no error in the error log.

Interestingly, a 302 result works correctly. A static page display is  
fine also. I have rebuilt perl & mod_perl since I encountered the  
error to no avail.


I have tested with no modules loaded into apache - and with template  
toolkit - which appears to be working correctly except for the  
problem above. I compiled mod_perl as a dso; no threads; everything  
else default.


Thanks for the help:


2. Used Components and their Configuration:

*** mod_perl version 2.03

*** using /tmp/mod_perl-2.0.3/lib/Apache2/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_LIB => aprext
  MP_APXS=> /usr/sbin/apxs
  MP_COMPAT_1X   => 1
  MP_GENERATE_XS => 1
  MP_LIBNAME => mod_perl
  MP_USE_DSO => 1


*** /usr/sbin/httpd -V
Server version: Apache/2.2.6 (Unix)
Server built:   Dec 28 2007 00:27:39
Server's Module Magic Number: 20051115:5
Server loaded:  APR 1.2.11, APR-Util 1.2.10
Compiled using: APR 1.2.11, APR-Util 1.2.10
Architecture:   32-bit
Server MPM: Prefork
  threaded: no
forked: yes (variable process count)
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 DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/usr"
 -D SUEXEC_BIN="/usr/bin/suexec"
 -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/httpd/conf/mime.types"
 -D SERVER_CONFIG_FILE="/etc/httpd/conf/httpd.conf"

*** /usr/bin/ldd /usr/sbin/httpd
linux-gate.so.1 =>  (0x00e17000)
libm.so.6 => /lib/libm.so.6 (0x00c9e000)
libaprutil-1.so.0 => /usr/lib/libaprutil-1.so.0 (0x00388000)
libpq.so.4 => /usr/lib/libpq.so.4 (0x002b2000)
libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0x005ae000)
libexpat.so.0 => /usr/lib/libexpat.so.0 (0x00766000)
libapr-1.so.0 => /usr/lib/libapr-1.so.0 (0x00365000)
libuuid.so.1 => /lib/libuuid.so.1 (0x003ae000)
librt.so.1 => /lib/librt.so.1 (0x003f)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x00cee000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00cda000)
libdl.so.2 => /lib/libdl.so.2 (0x00c98000)
libc.so.6 => /lib/libc.so.6 (0x00b6d000)
/lib/ld-linux.so.2 (0x00b4f000)
libssl.so.5 => /lib/libssl.so.5 (0x00d95000)
libcrypto.so.5 => /lib/libcrypto.so.5 (0x00101000)
libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x0021)
libresolv.so.2 => /lib/libresolv.so.2 (0x00d1e000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00d33000)
libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00d5)
libcom_err.so.2 => /lib/libcom_err.so.2 (0x00d4b000)
libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00d6a000)
libz.so.1 => /usr/lib/libz.so.1 (0x00cc5000)
libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00d9)


*** (apr|apu)-config linking info

 -L/usr/lib -laprutil-1 -lpq -lsqlite3 -lexpat
 -L/usr/lib -lapr-1 -luuid -lrt -lcrypt  -lpthread -ldl



*** /usr/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
osname=linux, osvers=2.6.14-1.1653_fc4smp, archname=i686-linux
uname='linux nat.longmedia.com 2.6.14-1.1653_fc4smp #1 smp tue  
dec 13 21:46:01 est 2005 i686 i686 i386 gnulinux '

config_args=''
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 us

Re: [bugreport] Internal Server Error output - but no error

2007-12-30 Thread Kate Yoak
I have solved the problem. I was returning 200 instead of using  
Apache2::Const::OK. My response was indeed interpreted as 'OK" by  
apache - but not by some place somewhere else. There was no error  
message anywhere. I'll modify the bugreport below to have it  
addressed or not at the maintainers' discretion.

On Dec 29, 2007, at 11:14 AM, Kate Yoak wrote:


I am using mp2bug format for the message.  Hope, that's ok!


=
-8<-- Start Bug Report 8<--
1. Problem Description:


returning 200 as a scalar from a content handler causes Apache to  
spit up "Internal Server Error" html despite a '200 OK'  status.  
There is no error or warning in the log, nor any other indication of  
a problem



sub handler{
return 200;
}

Generates the proper headers:
HTTP/1.1 200 OK
Date: Sun, 30 Dec 2007 03:12:03 GMT
Server: Apache/2.2.6 (Unix) mod_perl/2.0.3 Perl/v5.8.8
Content-Length: 497
Content-Type: text/html; charset=iso-8859-1

But then adds a 500 error html to the output:


200 OK

OK
The server encountered an internal error or
misconfiguration and was unable to complete
your request.
Please contact the server administrator,
 [EMAIL PROTECTED] and inform them of the time the error occurred,
and anything you might have done that may have
caused the error.
More information about this error may be available
in the server error log.



Interestingly, a 302 result works correctly. A static page display  
is fine also. I have rebuilt perl & mod_perl since I encountered  
the error to no avail.


2. Used Components and their Configuration:

*** mod_perl version 2.03

*** using /tmp/mod_perl-2.0.3/lib/Apache2/BuildConfig.pm

*** Makefile.PL options:
  MP_APR_LIB => aprext
  MP_APXS=> /usr/sbin/apxs
  MP_COMPAT_1X   => 1
  MP_GENERATE_XS => 1
  MP_LIBNAME => mod_perl
  MP_USE_DSO => 1


*** /usr/sbin/httpd -V
Server version: Apache/2.2.6 (Unix)
Server built:   Dec 28 2007 00:27:39
Server's Module Magic Number: 20051115:5
Server loaded:  APR 1.2.11, APR-Util 1.2.10
Compiled using: APR 1.2.11, APR-Util 1.2.10
Architecture:   32-bit
Server MPM: Prefork
  threaded: no
forked: yes (variable process count)
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 DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/usr"
 -D SUEXEC_BIN="/usr/bin/suexec"
 -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/httpd/conf/mime.types"
 -D SERVER_CONFIG_FILE="/etc/httpd/conf/httpd.conf"

*** /usr/bin/ldd /usr/sbin/httpd
linux-gate.so.1 =>  (0x00e17000)
libm.so.6 => /lib/libm.so.6 (0x00c9e000)
libaprutil-1.so.0 => /usr/lib/libaprutil-1.so.0 (0x00388000)
libpq.so.4 => /usr/lib/libpq.so.4 (0x002b2000)
libsqlite3.so.0 => /usr/lib/libsqlite3.so.0 (0x005ae000)
libexpat.so.0 => /usr/lib/libexpat.so.0 (0x00766000)
libapr-1.so.0 => /usr/lib/libapr-1.so.0 (0x00365000)
libuuid.so.1 => /lib/libuuid.so.1 (0x003ae000)
librt.so.1 => /lib/librt.so.1 (0x003f)
libcrypt.so.1 => /lib/libcrypt.so.1 (0x00cee000)
libpthread.so.0 => /lib/libpthread.so.0 (0x00cda000)
libdl.so.2 => /lib/libdl.so.2 (0x00c98000)
libc.so.6 => /lib/libc.so.6 (0x00b6d000)
/lib/ld-linux.so.2 (0x00b4f000)
libssl.so.5 => /lib/libssl.so.5 (0x00d95000)
libcrypto.so.5 => /lib/libcrypto.so.5 (0x00101000)
libkrb5.so.3 => /usr/lib/libkrb5.so.3 (0x0021)
libresolv.so.2 => /lib/libresolv.so.2 (0x00d1e000)
libnsl.so.1 => /lib/libnsl.so.1 (0x00d33000)
libgssapi_krb5.so.2 => /usr/lib/libgssapi_krb5.so.2 (0x00d5)
libcom_err.so.2 => /lib/libcom_err.so.2 (0x00d4b000)
libk5crypto.so.3 => /usr/lib/libk5crypto.so.3 (0x00d6a000)
libz.so.1 => /usr/lib/libz.so.1 (0x00cc5000)
libkrb5support.so.0 => /usr/lib/libkrb5support.so.0 (0x00d9)


*** (apr|apu)-config linking info

 -L/usr/lib -laprutil-1 -lpq -lsqlite3 -lexpat
 -L/usr/lib -lapr-1 -luuid -lrt -lcrypt  -lpthread -ldl



*** /usr/bin/perl -V
Summary of my perl5 (revision 5 version 8 subversion 8) configuration:
  Platform:
osname=linux, osvers=2.6.14-1.1653_fc4smp, archname=i686-linux
uname='linux nat.longmedia.com 2.6.14-1.1653_fc4smp #1 smp tue  
dec 13 21:46:01 est 2005 i686 i686 i386 gnulinux '


RE: print

2008-01-04 Thread Kate Yoak
Of course... I saw that - but it didn't sync in... Thanks!

-Original Message-
From: Michael Peters [mailto:[EMAIL PROTECTED] 
Sent: Friday, January 04, 2008 1:37 PM
To: Kate Yoak
Cc: modperl@perl.apache.org
Subject: Re: print


Kate Yoak wrote:
> I keep running into methods not implemented where documentation says 
> they are.  Is it something about me or a common problem?

One of the new features of mod_perl 2 is less memory usage by default. It
does this by not loading some of those extra methods unless you ask for
them.

This gives an easy way to find out which packages methods now belong in:
http://perl.apache.org/docs/2.0/user/porting/porting.html#Using_C_ModPerl__M
ethodLookup__to_Discover_Which_mod_perl_2_0_Modules_Need_to_Be_Loaded

-- 
Michael Peters
Developer
Plus Three, LP




print

2008-01-04 Thread Kate Yoak
I keep running into methods not implemented where documentation says they
are.  Is it something about me or a common problem?
 
sub handler{
my $r = shift;
$r->print("hello");
}
 
fails with "Can't locate object method print via package
Apache2::RequestRec"
 
   Apache2->request
 
fails with Can't locate object method "request" via package "Apache2".
(That method is described in Apache2::RequestUtil which I loaded).
 
Should I be loading any modules other than Apache2::RequestRec?
 
Thanks!


RE: page finishes loading _after_ PerlCleanupHandler

2008-01-05 Thread Kate Yoak


> Hi, while testing the PerlCleanupHandler in HTML::Mason:
> 
> <%init>
> $r->push_handlers(PerlCleanupHandler => \&sleeptest);
> 
> sub sleeptest {
> my $r = shift;
> $r->warn("BEFORE SLEEP");
> sleep(10);
> $r->warn("AFTER SLEEP");
> };
> 
> 
> I've noticed that the page only finishes loading after the 
> PerlCleanupHandler has completely executed. A per the 
> documentation the cleanup is code is supposed to happen after 
> the client is gone, not while he's waiting.

I became curious and tested this by registering a PerlCleanupHandler
directly in apache. Documentation is correct - content was served before the
cleanup handler.

I know Mason quite well but I can't find any explanation for what you are
seeing... I know they try to delay sending content until the last possible
moment to ensure that any and all headers make it in. But I don't see how
they'd make it past the content phase.  Mason has an excellent mailing list,
btw - somewhere on masonhq.com. May be somebody can make sense of it there!
Good luck.



Flushing output and preserving headers

2009-01-03 Thread Kate Yoak

Hey guys,

I seem to have some magic going on in the background and it has  
stopped me in my tracks.


The actual problem is that my Content-type header gets overwritten  
before it is sent back to the client. In addition, I am unable to  
flush the output.


Here is the idea:

$r->headers_out->set('Content-Type' => "image/gif");
warn $r->headers_out->get('Content-Type');
#warns image/gif

for my $i (0..5){
sleep(1);
$r->print($i);
$r->rflush; #does not send $i to client. The headers do arrive at the  
first iteration (with the wrong content-type).

warn $r->headers_out->get('Content-Type');
#warns text/plain
}

#sends 012345, all at once

Server version: Apache/2.2.8 (Unix)
mod_perl-2.0.2-6.3.el5

Server: Apache/2.2.8 (Unix) DAV/2 mod_apreq2-20051231/2.6.0 mod_perl/ 
2.0.4 Perl/v5.8.8



Where is the magic?
Cheers,
Kate


RE: Flushing output and preserving headers

2009-01-03 Thread Kate Yoak
That worked! Thanks.

> -Original Message-
> From: Torsten Foertsch [mailto:torsten.foert...@gmx.net] 
> Sent: Saturday, January 03, 2009 7:31 AM
> To: modperl@perl.apache.org
> Cc: Kate Yoak
> Subject: Re: Flushing output and preserving headers
> 
> 
> On Sat 03 Jan 2009, Kate Yoak wrote:
> > $r->headers_out->set('Content-Type' => "image/gif");
> 
> use $r->content_type(...)
> 
> Torsten
> 
> -- 
> Need professional mod_perl support?
> Just hire me: torsten.foert...@gmx.net
>