From:             avarnals at zigg dot net
Operating system: Linux 2.4.21
PHP version:      4.3.3
PHP Bug Type:     Apache2 related
Bug description:  connection_status() ( see bug #22072 ).

Description:
------------
See bug #22072.

Since the above is now closed, I am creating this entry. Please accept my
apologies if it would have been better added to 22072 instead.

I wasn't aware of this potential problem until I saw it in the change log
for 4.3.3, so I thought I'd test it. Something is still not right. I'm
using PHP 4.3.3 with Apache 2.0.47.

My first test was to see whether ignore_user_abort() works as expected. I
used the very simple:

  ignore_user_abort ( false );
  while ( 1 );

This makes it easy to spot in the process list using 'top'. I tested both
using PHP as a dynamically loaded Apache module and the CGI binary. The
latter had safe mode enabled, the former didn't; I don't know whether this
can/should make any difference. In both cases the script continued to
execute after I clicked on the browser's stop button and until its PHP
enforced time limit was reached.

I then went on to test ( using only the Apache module ) using the code
suggested in bug report 22072:

  http://www.mpfreescene.com/test/?option=source

As rather expected now, this continued to execute after I'd used the stop
button.

I went on to test by modifying the code as follows:

  - I set set_time_limit(15); so it would eventually be
      aborted by this limit.
  - I made $m very large.
  - Have the result of connection_status() written to a
      file each time round the loop.
  - I removed the sleep() call.

I ran the script and used the stop button while it was running. It
continued to execute until it had used 15 seconds of CPU time. Log file
shows: httpd: PHP Fatal error:  Maximum execution time of 15 seconds
exceeded in...
The final ( large ) output file contained all zeros and a final 2.

So, it seems that PHP correctly detects and reports the case of a timeout,
but not an abort.

I noticed one other possibly odd thing while doing this. If PHP has output
buffering enabled, the call to flush() results in the script being
immediately shut down ( execution doesn't get to the line following
flush() ). The result of connection_status() when called in exitfp() is
then 1. If the flush() call is removed, the results as previously
described are the same whether or not output buffering is enabled.

I hope someone can make sense of all this! Do let me know if you would
like any further information.



-- 
Edit bug report at http://bugs.php.net/?id=25266&edit=1
-- 
Try a CVS snapshot (php4):  http://bugs.php.net/fix.php?id=25266&r=trysnapshot4
Try a CVS snapshot (php5):  http://bugs.php.net/fix.php?id=25266&r=trysnapshot5
Fixed in CVS:               http://bugs.php.net/fix.php?id=25266&r=fixedcvs
Fixed in release:           http://bugs.php.net/fix.php?id=25266&r=alreadyfixed
Need backtrace:             http://bugs.php.net/fix.php?id=25266&r=needtrace
Try newer version:          http://bugs.php.net/fix.php?id=25266&r=oldversion
Not developer issue:        http://bugs.php.net/fix.php?id=25266&r=support
Expected behavior:          http://bugs.php.net/fix.php?id=25266&r=notwrong
Not enough info:            http://bugs.php.net/fix.php?id=25266&r=notenoughinfo
Submitted twice:            http://bugs.php.net/fix.php?id=25266&r=submittedtwice
register_globals:           http://bugs.php.net/fix.php?id=25266&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=25266&r=php3
Daylight Savings:           http://bugs.php.net/fix.php?id=25266&r=dst
IIS Stability:              http://bugs.php.net/fix.php?id=25266&r=isapi
Install GNU Sed:            http://bugs.php.net/fix.php?id=25266&r=gnused

Reply via email to