Forum Moderators: coopster & phranque

Message Too Old, No Replies

apache2.2+mod perl and $¦=1

buffer prblem

         

freizz

9:00 pm on Oct 2, 2007 (gmt 0)

10+ Year Member



Hi,

I'm having this issue after upgrading from a mdk-10.1 (apache 1.3.x/mod_perl) server to a centos5 (apache 2.2.x/mod_perl).

I'm displaying a "wait page" while the script is doing it's thing.

Used to work fine, but not anymore, under Apache 2.2/mod_perl.

Instead of Start-DisplayWaitPage-workworkwork-DisplayResult, I get Start-workworkwor-DisplayWaitPage-DispayResult... In play words... I stare at a blank page for 20 seconds as opposed to a beatifull "please wait" web page...

The html is identical across setups.
It's as if the apache is trying to compress the result page (therefore waiting for the end of the script before displaying anything)... But no compression is performed.

Please Help
Thanx

FreiZz

perl_diver

12:19 am on Oct 3, 2007 (gmt 0)

10+ Year Member



sounds like the output is being buffered. Try:

$¦=1;

at the bginning of the scrip or just before any output.

freizz

12:30 am on Oct 3, 2007 (gmt 0)

10+ Year Member



Hi,

$¦=1; is at the beginning of the script (and the subject of this post)...

I've tried many things...
I've checked the headers on the response and it is not compressed or anything.

There is no apparent reason why apache is waiting on the end of the script to send the output...

The same code works with apache2 (no mod_perl)...

It's basically:

print blabal... do your stuff... print refresh.. print result...

FreiZz

perl_diver

12:41 am on Oct 3, 2007 (gmt 0)

10+ Year Member



sorry, I don't know.

vincevincevince

12:49 am on Oct 3, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Welcome to WebmasterWorld [webmasterworld.com] freizz, I hope you find some help here.

Spew out \n characters, 512 of them at least, after the wait page. In general, you can never send enough \n characters.

You need to sometimes manually overflow various levels of buffering to get your wait page out, so good luck!

phranque

12:42 pm on Oct 3, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



welcome to WebmasterWorld, freizz!

i would write some stuff to the apache error log at strategic points in your script.
then i would synchronise what you see in the server logs (when your script did what and when it says it served your responses) with when you saw the responses.

freizz

6:10 pm on Oct 3, 2007 (gmt 0)

10+ Year Member



Thanx guys, I appreciate the suggestions...

I even tried to 512+ \n to fill the buffer and all.. but nothing... here is more details :

The code :
#!/usr/bin/perl
print "Content-Type: text/html\n\n";
print "---($¦)";
local $¦=1;
print "---($¦)";
print "1....2...";
sleep 5;
print "3....4...";
print "---($¦)";

The output :
<wait 5 seconds>---(0)---(1)1....2...3....4...---(1)

I should be getting :
---(0)---(1)1....2...<wait 5 seconds>3....4...---(1)

Server :
- CentOS release 5 (Final)
- mod_perl-2.0.2-6.3.el5
- httpd-2.2.3-7.el5.centos
Conf:
<Directory /some/directory>
SetHandler perl-script
PerlResponseHandler ModPerl::RegistryPrefork
Options +ExecCGI
PerlOptions +ParseHeaders
Options FollowSymLinks ExecCGI
</Directory>

FreiZz

[edited by: jatar_k at 6:21 pm (utc) on Oct. 3, 2007]
[edit reason] disabled smilies [/edit]