You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Axel Andersson <mo...@animanga.nu> on 2002/03/01 14:39:35 UTC

Blank pages

Hi,
I run a mod_perl/mysql site, which works fine most of the time. Some
pages, however, come out completely blank. Reload.. and hey presto, it
works. Now, I realize this could be practically anything, so I'm just
asking if anyone has come across something similar.

I use Apache::DBI 0.88 for database connections, Apache 1.3.23 and
mod_perl/1.2. Strange thing is, nothing shows up in the error log, even
using -w.

Well, it's a longshot, but thanks anyway.

Axel Andersson

-- 
morris@animanga.nu
http://www.animanga.nu/morris/

31. With intagible breath in center of forehead, as this reaches heart at
the moment of sleep, have direction over dreams and over death itself.


Re: Blank pages

Posted by Perrin Harkins <pe...@elem.com>.
John E. Leon Guerrero wrote:
> in my case, we had a number of scripts that would change
> STDOUT in some fashion (usually so they could set $|) but then die due to
> some error before resetting STDOUT back.

Interesting.  One safety measure to prevent this would be to install a 
cleanup handler that resets STDOUT.  This is a similar concept to the 
rollback that Apache::DBI issues in a cleanup handler.

- Perrin


RE: Blank pages

Posted by "John E. Leon Guerrero" <jg...@live365.com>.
i ran into a number of similar problems that did not seem to be documented
anywhere else.  in my case, we had a number of scripts that would change
STDOUT in some fashion (usually so they could set $|) but then die due to
some error before resetting STDOUT back.  then any mod-perl script that the
child would serve would produce a blank page while static files would
continue
to be served cleanly.  when that child died, the problem would go away.  if
a
user refreshed and got another child, then it would appear as if the problem
went away.

i added the PID to the access logs and watched for any HTTP 200's with zero
length
body sizes and traced backwards to see who the common culprit was.  the only
caveat was that apache would sometimes log HTTP 200 when in fact the return
code
was HTTP 302 (redirect).  it is natural to have a zero length body size for
a
redirect.

good luck,
John E. Leon Guerrero

> -----Original Message-----
> From: Axel Andersson [mailto:morris@animanga.nu]
> Sent: Friday, March 01, 2002 5:40 AM
> To: modperl@apache.org
> Subject: Blank pages
>
>
> Hi,
> I run a mod_perl/mysql site, which works fine most of the time. Some
> pages, however, come out completely blank. Reload.. and hey presto, it
> works. Now, I realize this could be practically anything, so I'm just
> asking if anyone has come across something similar.
>
> I use Apache::DBI 0.88 for database connections, Apache 1.3.23 and
> mod_perl/1.2. Strange thing is, nothing shows up in the error log, even
> using -w.
>
> Well, it's a longshot, but thanks anyway.
>
> Axel Andersson
>
> --
> morris@animanga.nu
> http://www.animanga.nu/morris/
>
> 31. With intagible breath in center of forehead, as this reaches heart at
> the moment of sleep, have direction over dreams and over death itself.
>


Re: Blank pages

Posted by ma...@maxcalvo.net.
Ged Haywood writes:

> Hi there, 
> 
> On Fri, 1 Mar 2002, Axel Andersson wrote: 
> 
>> I run a mod_perl/mysql site, which works fine most of the time. Some
>> pages, however, come out completely blank. Reload.. and hey presto,
> [snip]
>> Well, it's a longshot, but thanks anyway.
> 
> Another long shot, do you always specify full paths to files in your code?

> 
> If you don't get anywhere with that then I'd suggest looking at the debugging
> section of the Guide: http://prel.apache.org/guide and/or peppering your code
> at strategic places with 'print STDERR "$something_useful\n"' statements. 
> 
> 73,
> Ged. 
> 
 

 

I have been getting the same problems with  the same setup ( Mod_Perl / 
MySQL). But I am having a little fun with this setup. I populated a small 
table in the 'test' DB in MySQL withe the contents of 
'/usr/local/share/dict/propernames'. I then have the script to randomly 
chose an id from the DB table and then to select a row of info. I will post 
the scipt contents and some debugging data to give some more info on the 
internal processes. 

The Script is : 

     1 package DBNE;
     2
     3 use strict;
     4 use vars qw($DBH);
     5 use Apache;
     6 #use Apache::File;
     7 use DBI();
     8
     9 sub handler {
    10         $DBH = DBI->connect("DBI:mysql:test","webuser","mult1scan") 
|| die $DBH->errstr;
    11         my $r = shift;
    12         my $h = $DBH->trace(5,"/tmp/DBI.log");
    13
    14         $r->send_http_header;
    15         my $sth = $DBH->prepare("SELECT MAX(id) FROM webtest");
    16         $sth->execute;
    17         my ($id) = $sth->fetchrow;
    18
    19         my $sth = $DBH->prepare("SELECT * FROM webtest WHERE id = 
ROUND( (RAND() * $id) + 1)");
    20         $sth->execute;
    21
    22         my ($id,$name,$last,$town) = $sth->fetchrow;
    23         $r->print("$id\t\t $name\t\t $last\t\t $town \n");
    24         $sth->finish;
    25
    26 }
    27
    28 1; 

The debuging info is: 


     <- DESTROY= undef at /home/mcalvo/ModPerl/DBNE.pm line 11
   DBI::db=HASH(0x81faf3c) trace level set to 5 in DBI 1.20-nothread
   Note: perl is running without the recommended perl -w option
   -> prepare for DBD::mysql::db (DBI::db=HASH(0x81e90e4)~0x81faf3c 'SELECT 
MAX(id) FROM webtest')
   dbih_setup_handle(DBI::st=HASH(0x8156390)=>DBI::st=HASH(0x81e90d8), 
DBD::mysql::st, 81faef4, Null!)
   dbih_make_com(DBI::db=HASH(0x81faf3c), DBD::mysql::st, 204)
   dbih_setup_attrib(DBI::st=HASH(0x81e90d8), Err, DBI::db=HASH(0x81faf3c)) 
SCALAR(0x818bc78) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81e90d8), State, 
DBI::db=HASH(0x81faf3c)) SCALAR(0x81aef9c) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81e90d8), Errstr, 
DBI::db=HASH(0x81faf3c)) SCALAR(0x818bc54) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81e90d8), Handlers, 
DBI::db=HASH(0x81faf3c)) ARRAY(0x81e90b4) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81e90d8), Debug, 
DBI::db=HASH(0x81faf3c)) 5 (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81e90d8), FetchHashKeyName, 
DBI::db=HASH(0x81faf3c)) 'NAME' (already defined)
Setting mysql_use_result to 0
   <- prepare= DBI::st=HASH(0x8156390) at /home/mcalvo/ModPerl/DBNE.pm line 
15
   -> execute for DBD::mysql::st (DBI::st=HASH(0x8156390)~0x81e90d8)
   -> dbd_st_execute for 081fac90
   <- dbd_st_execute 1 rows
   <- execute= 1 at /home/mcalvo/ModPerl/DBNE.pm line 16
   -> fetchrow for DBD::mysql::st (DBI::st=HASH(0x8156390)~0x81e90d8)
   -> dbd_st_fetch for 081fac90, chopblanks 0
   dbih_setup_fbav for 1 fields => 0x8135854
     Storing row 0 (1323) in 081fae64
   <- dbd_st_fetch, 1 cols
   <- fetchrow= ( '1323' ) [1 items] row1 at /home/mcalvo/ModPerl/DBNE.pm 
line 17
   -> prepare for DBD::mysql::db (DBI::db=HASH(0x81e90e4)~0x81faf3c 'SELECT 
* FROM webtest WHERE id = ROUND( (RAND() * 1323) + 1)')
   dbih_setup_handle(DBI::st=HASH(0x81faf90)=>DBI::st=HASH(0x81faf24), 
DBD::mysql::st, 81faf78, Null!)
   dbih_make_com(DBI::db=HASH(0x81faf3c), DBD::mysql::st, 204)
   dbih_setup_attrib(DBI::st=HASH(0x81faf24), Err, DBI::db=HASH(0x81faf3c)) 
SCALAR(0x818bc78) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81faf24), State, 
DBI::db=HASH(0x81faf3c)) SCALAR(0x81aef9c) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81faf24), Errstr, 
DBI::db=HASH(0x81faf3c)) SCALAR(0x818bc54) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81faf24), Handlers, 
DBI::db=HASH(0x81faf3c)) ARRAY(0x81e90b4) (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81faf24), Debug, 
DBI::db=HASH(0x81faf3c)) 5 (already defined)
   dbih_setup_attrib(DBI::st=HASH(0x81faf24), FetchHashKeyName, 
DBI::db=HASH(0x81faf3c)) 'NAME' (already defined)
Setting mysql_use_result to 0
   <- prepare= DBI::st=HASH(0x81faf90) at /home/mcalvo/ModPerl/DBNE.pm line 
19
   -> execute for DBD::mysql::st (DBI::st=HASH(0x81faf90)~0x81faf24)
   -> dbd_st_execute for 081e9084
   <- dbd_st_execute 0 rows
   <- execute= '0E0' at /home/mcalvo/ModPerl/DBNE.pm line 20
   -> fetchrow for DBD::mysql::st (DBI::st=HASH(0x81faf90)~0x81faf24)
   -> dbd_st_fetch for 081e9084, chopblanks 0
   <- fetchrow= ( ) [0 items] row-1 at /home/mcalvo/ModPerl/DBNE.pm line 22
   -> finish for DBD::mysql::st (DBI::st=HASH(0x81faf90)~0x81faf24)
   <- finish= 1 at /home/mcalvo/ModPerl/DBNE.pm line 24
   -> DESTROY for DBD::mysql::st (DBI::st=HASH(0x81e90d8)~INNER)
   <- DESTROY= undef
   -> DESTROY for DBD::mysql::st (DBI::st=HASH(0x81faf24)~INNER)
   <- DESTROY= undef 


It seems that the query is returning 0 as a value but why?? Can any onw 
please help me. 

Thank you 

 -Max 


Re: Blank pages

Posted by Robert Landrum <rl...@capitoladvantage.com>.
At 6:54 PM +0000 3/1/02, Ged Haywood wrote:
>Hi there,
>
>On Fri, 1 Mar 2002, Axel Andersson wrote:
>
>> I run a mod_perl/mysql site, which works fine most of the time. Some
>> pages, however, come out completely blank. Reload.. and hey presto,
>[snip]
>> Well, it's a longshot, but thanks anyway.
>
>Another long shot, do you always specify full paths to files in your code?
>
>If you don't get anywhere with that then I'd suggest looking at the debugging
>section of the Guide: http://prel.apache.org/guide and/or peppering your code
>at strategic places with 'print STDERR "$something_useful\n"' statements.

I think Ged meant http://perl.apache.org/guide.

The full path thing is a good suggestion...  We recently came across 
a problem with chdir and relative paths.

Basically we'd chdir('/tmp'); and create some files (via pdflatex).  Then later
whenever we used that particular apache process, it would always 
start process requests as if it were in /tmp, which made local paths 
foobar.

httpd -X is a good way to test for this sort of problem.

Rob


--
When I used a Mac, they laughed because I had no command prompt. When 
I used Linux, they laughed because I had no GUI.  

Re: Blank pages

Posted by Ged Haywood <ge...@www2.jubileegroup.co.uk>.
Hi there,

On Fri, 1 Mar 2002, Axel Andersson wrote:

> I run a mod_perl/mysql site, which works fine most of the time. Some
> pages, however, come out completely blank. Reload.. and hey presto,
[snip]
> Well, it's a longshot, but thanks anyway.

Another long shot, do you always specify full paths to files in your code?

If you don't get anywhere with that then I'd suggest looking at the debugging
section of the Guide: http://prel.apache.org/guide and/or peppering your code
at strategic places with 'print STDERR "$something_useful\n"' statements.

73,
Ged.