From: julien at palard dot fr Operating system: GNU/Linux PHP version: 5.4.15 Package: Performance problem Bug Type: Bug Bug description:Huge memory usage on unknown Content-Type
Description: ------------ When a POST have an unknwon Content-Type, the php_default_post_reader store the body of the request three times : * In SG(request_info).post_data * In SET_VAR_STRINGL("HTTP_RAW_POST_DATA", ... * In SG(request_info).raw_post_data So, getting a 500Mb request body result in a 1.5Gb memory usage, easily triggering a "memory limit exhausted" error. Known content types are found in main/php_content_types.c and are "application/x-www-form-urlencoded" and "multipart/form-data", so this case is easily triggered. This fact seems well known as we can read in main/php_content_types.c:59 : /* for php://input stream: some post handlers modify the content of request_info.post_data so for now we need a copy for the php://input stream in the long run post handlers should be changed to not touch request_info.post_data for memory preservation reasons */ Solving this comment only fix 1/2 of the bug, keeping the body stored in two different locations, but it's a first step. I only open this ticket to track the history of this issue, I do not really need it to be fixed. -- Edit bug report at https://bugs.php.net/bug.php?id=64935&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=64935&r=trysnapshot54 Try a snapshot (PHP 5.3): https://bugs.php.net/fix.php?id=64935&r=trysnapshot53 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=64935&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=64935&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=64935&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=64935&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=64935&r=needscript Try newer version: https://bugs.php.net/fix.php?id=64935&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=64935&r=support Expected behavior: https://bugs.php.net/fix.php?id=64935&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=64935&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=64935&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=64935&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=64935&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=64935&r=dst IIS Stability: https://bugs.php.net/fix.php?id=64935&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=64935&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=64935&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=64935&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=64935&r=mysqlcfg