#24301 [Com]: readfile() and fpassthru() die with SEGV on a 64k file
ID: 24301 Comment by: joseph at serengeti dot com Reported By: hessu at hes dot iki dot fi Status: No Feedback Bug Type: Apache2 related Operating System: linux 2.4.20 PHP Version: 4CVS-2003-06-23 (stable) New Comment: FreeBSD 4.9 Release mod_php4-4.3.4_6 apache 2.0.48 fpassthrough and readfile both cause a segv intermittently with the following file, there may be others this is the only one I tested with. -rw-rw-rw- 1 builder wheel 1802240 Mar 1 16:13 BRTL_STE_4-5-0-7.exe as you can see this is not 2^x file size but my symptoms are identical and were fixed the same way (by changing to fopen,fread,print) I fixed readfile by changing #define HAVE_MMAP to #undef HAVE_MMAP in main/php_config.h and rebuilding. That may or may not be usefull to you. Previous Comments: [2003-07-07 02:41:39] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. [2003-06-30 05:51:54] [EMAIL PROTECTED] Please give the requested feedback or let this report rot.. [2003-06-30 03:32:26] [EMAIL PROTECTED] Use apache1; apache2 + php is not a production combination as you have discovered. [2003-06-23 21:29:35] [EMAIL PROTECTED] I can not reproduce this within Apache 1.3.27. Could you please try that too to make sure it's just apache2 related issue..(FYI: Apache2 with PHP is really not ready for production use) [2003-06-23 14:50:16] hessu at hes dot iki dot fi Description: php-4.3.2 and php4-STABLE-200306231730 on apache-2.0.46, RedHat Linux on i386, vanilla 2.4.20 kernel, gcc version 3.2 20020903 (Red Hat Linux 8.0 3.2-7). When trying to send a binary or ascii file of exactly 65536 bytes using readfile() or fpassthru(), the httpd process dies with a SIGSEGV. If the file is 65535 or 65537 bytes long, it is sent out just fine. 32768 and 131072 bytes do not seem to crash, either. The same source file does not crash the command line version of php. Reproduce code: --- $ cat 64kcrash.php $ $ dd if=/dev/urandom of=64k-of-data bs=1 count=65536 OR $ perl -e 'print "a" × 65536;' > 64k-of-data Expected result: The contents of the file should be sent. Actual result: -- [Mon Jun 23 22:46:56 2003] [notice] child pid 7805 exit signal Segmentation fault (11) client gets EOF after sending the request. -- Edit this bug report at http://bugs.php.net/?id=24301&edit=1
#24301 [Com]: readfile() and fpassthru() die with SEGV on a 64k file
ID: 24301 Comment by: matthieu dot paineau at wanadoo dot fr Reported By: hessu at hes dot iki dot fi Status: No Feedback Bug Type: Apache2 related Operating System: linux 2.4.20 PHP Version: 4CVS-2003-06-23 (stable) New Comment: As described... there is bugs with filesize equal to 16k and 32k... maybe (16 * n) k sizes ??? So, i have circumvented the problem with this : replaced : readfile($filename); by: $fp=fopen($filename,"r"); $contents = fread ($fp, filesize($filename)); fclose($fp); echo $contents; Previous Comments: [2003-12-24 14:12:32] scotje at wwc dot edu I can now confirm that this bug does not exist with Apache 1.3.x and all other circumstances and packages unchanged (apart from a mod_php recompile of course). [2003-12-24 02:13:51] scotje at wwc dot edu This also seems to occur with PHP 4.3.3 / Apache 2.0.48 on Gentoo with a 16k (16384 bytes) file. When I padded the file out to a larger amount (21k) the problem disappeared. I think I'm going to move my apache back down to 1.3.27, but this is definately an annoying and rather difficult to track down bug. [2003-07-07 02:41:39] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. [2003-06-30 05:51:54] [EMAIL PROTECTED] Please give the requested feedback or let this report rot.. [2003-06-30 03:32:26] [EMAIL PROTECTED] Use apache1; apache2 + php is not a production combination as you have discovered. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/24301 -- Edit this bug report at http://bugs.php.net/?id=24301&edit=1
#24301 [Com]: readfile() and fpassthru() die with SEGV on a 64k file
ID: 24301 Comment by: scotje at wwc dot edu Reported By: hessu at hes dot iki dot fi Status: No Feedback Bug Type: Apache2 related Operating System: linux 2.4.20 PHP Version: 4CVS-2003-06-23 (stable) New Comment: I can now confirm that this bug does not exist with Apache 1.3.x and all other circumstances and packages unchanged (apart from a mod_php recompile of course). Previous Comments: [2003-12-24 02:13:51] scotje at wwc dot edu This also seems to occur with PHP 4.3.3 / Apache 2.0.48 on Gentoo with a 16k (16384 bytes) file. When I padded the file out to a larger amount (21k) the problem disappeared. I think I'm going to move my apache back down to 1.3.27, but this is definately an annoying and rather difficult to track down bug. [2003-07-07 02:41:39] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. [2003-06-30 05:51:54] [EMAIL PROTECTED] Please give the requested feedback or let this report rot.. [2003-06-30 03:32:26] [EMAIL PROTECTED] Use apache1; apache2 + php is not a production combination as you have discovered. [2003-06-30 00:51:42] hessu at hes dot iki dot fi I still have the problem, I haven't had the time to try with apache1 quite yet. What should we do if this is apache2 specific? The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/24301 -- Edit this bug report at http://bugs.php.net/?id=24301&edit=1
#24301 [Com]: readfile() and fpassthru() die with SEGV on a 64k file
ID: 24301 Comment by: scotje at wwc dot edu Reported By: hessu at hes dot iki dot fi Status: No Feedback Bug Type: Apache2 related Operating System: linux 2.4.20 PHP Version: 4CVS-2003-06-23 (stable) New Comment: This also seems to occur with PHP 4.3.3 / Apache 2.0.48 on Gentoo with a 16k (16384 bytes) file. When I padded the file out to a larger amount (21k) the problem disappeared. I think I'm going to move my apache back down to 1.3.27, but this is definately an annoying and rather difficult to track down bug. Previous Comments: [2003-07-07 02:41:39] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. [2003-06-30 05:51:54] [EMAIL PROTECTED] Please give the requested feedback or let this report rot.. [2003-06-30 03:32:26] [EMAIL PROTECTED] Use apache1; apache2 + php is not a production combination as you have discovered. [2003-06-30 00:51:42] hessu at hes dot iki dot fi I still have the problem, I haven't had the time to try with apache1 quite yet. What should we do if this is apache2 specific? [2003-06-29 21:18:49] [EMAIL PROTECTED] No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Open". Thank you. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/24301 -- Edit this bug report at http://bugs.php.net/?id=24301&edit=1