Bug #69414 [NEW]: Script hangs forever
| From: | deivid dot garcia dot garcia at gmail dot com | Date: | Fri, 10 Apr 2015 01:39:15 +0000 |
| Subject: | Bug #69414 [NEW]: Script hangs forever | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-191928@lists.php.net to get a copy of this message | ||
From: deivid dot garcia dot garcia at gmail dot com
Operating system: IIS 8.5
PHP version: 5.6.7
Package: Output Control
Bug Type: Bug
Bug description:Script hangs forever
Description:
------------
I've been experiencing for a very long time IIS spinning UP hundreds of
fast-cgi processes, rendering the server unusable.
Today I came across this situation that seems related to IIS spinning up
so many instances.
In Drupal, thumbnail generation is done on the fly. The Conent-Length
headers are sent before sending the file to the client, but if anything
fails during this process, the client will remain endlesly connected
(waiting for the rest of the response) even if the script has finished
or exit() has been called.
It looks like the fast-cgi processes are not released until they time
out, even if exit() was called. Because IIS thinks these processes are
busy, it spins up new processes (depending on the MAX setting in IIS) or
makes new requests wait until the locked fast-cgi processes have been
freed.
I'm not an HTTP protocol expert, but there must be some way for PHP to
tell the client that there's nothing else to wait for because the script
has already finished execution.
Test script:
---------------
<?php
header('Content-Length: 2838');
// Something went wrong while preparing the output data
// so send a 500 and exit
header('Status: 503 Service Unavailable');
print 'Custom message';
exit(500);
Expected result:
----------------
Expect to see the 'Custom Message' in the browser inmediately, instead
of the client timing out and holding the fast-cgi process hostage until
it times out.
--
Edit bug report at https://bugs.php.net/bug.php?id=69414&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69414&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69414&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69414&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69414&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69414&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69414&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69414&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69414&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69414&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69414&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69414&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69414&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69414&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69414&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69414&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69414&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69414&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69414&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69414&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69414&r=mysqlcfg