Operating System - HP-UX
1821410 Members
2695 Online
109633 Solutions
New Discussion юеВ

Apache2 buffers cgi output

 
Jeremy Norfolk
Occasional Contributor

Apache2 buffers cgi output

Hello. I wondered if anyone else had noticed this with Apache2, and if anyone had an idea on how to stop it..

I recently moved our intranet from Apache1.3 onto Apache2 (11i). We use cgi-bin scripts that take a long(ish) time to run so I have them printing status messages to the browser every few seconds.

Now, under Apache2, my cgi scripts buffer up their output and send it all to the browser in 32Kb (approx.) chunks, so as far as the user's concerned it just sits there and does nothing until the end of page (or 32Kb) is reached.

As a test, I created a script (attached) to chuck out 1Kb blocks every second. Under Apache 1.3 (HPUX 10.20 & 11.00) it outputs in 1 second intervals, but when it's run on Apache2 the buffering effect occurs. I also get the buffer effect when telnetting to port 80 from a session on the server itself and doing a "GET /cgi-bin/philtest.cgi" so it's definatly not a browser or network caching issue.
As well as the shell script, a very helpful chap at HP supplied me with a C version of the test script that did a 'fflush(stdout);' after each block, sadly this had the same effect.

According to the apache.org FAQ, (cgi-bin buffering was an issue unil Apache v1.3, but now Apache doesn't buffer it's output at all.

I'm fully patched up (via the online support manager thing, as of last week), and running the depot-installed Apache (version 2.0.39.05.03) on HPUX11i, on an N-class.

Does anyone have an idea what's doing the buffering, and if I can safely or temporarily turn it off?

Best Regards,
Phil Jones
2 REPLIES 2
benoit Bruckert
Honored Contributor

Re: Apache2 buffers cgi output

Hi Phil,
I don't think if this will help you, but I 've noticed 2 different way of work on the client side :
With I.E. I received line step by step I could see it line by line, with netscape I had to wait for all the lines of the page to see anything.
But it was an APache server 1.3.26.
And as you wrote it, the telnet (which has no cache/buffer efffect) work in the same way

I also made the test with Apache2 server with your script and it works fine for me !!!

The main diff I have with your config, is that it's running on HP-UX 11.00, and it's not a depot for Apache but an home made (I compiled it myself !).
You could try to compile on your own, may be there's an issue with the built-in apache from HP...
I know it's not a lot, but the fact that it works for me means that there's a solution...
May be there's a trouble with httpd.conf...
If you give me the path configuration, and configure options, I can build an httpd binary for you to make a test..

Hope it will help...
Benoit



Une application mal pans├йe aboutit ├а une usine ├а gaze (GHG)
Jeremy Norfolk
Occasional Contributor

Re: Apache2 buffers cgi output

Thanks, Benoit, it's reassuring to know that someone else is running Apache 2 and it doesn't buffer so aggressively.
You've inspired me to try building Apache2 muself on a "spare" server (same spec). I'll post the results here for completeness.

Phil