php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57950 php-fastcgi dies & zend_mm_heap corrupted
Submitted: 2007-12-04 08:16 UTC Modified: 2007-12-04 16:46 UTC
From: oliver at realtsp dot com Assigned:
Status: Not a bug Package: APC (PECL)
PHP Version: 5.2.1 OS: FreeBSD 6.1
Private report: No CVE-ID: None
 [2007-12-04 08:16 UTC] oliver at realtsp dot com
Description:
------------
system/version info at bottom

the lighttpd errorlog has these entries on a regular basis

2007-12-04 12:33:25: (mod_fastcgi.c.2462) unexpected end-of-file (perhaps the fastcgi process died): pid: 95332 socket: unix:/var/run/lighttpd/php-fastcgi.socket-0
2007-12-04 12:33:25: (mod_fastcgi.c.3269) response already sent out, but backend returned error on socket: unix:/var/run/lighttpd/php-fastcgi.socket-0 for /shop/rwf.php , terminating connection
2007-12-04 12:33:41: (mod_fastcgi.c.2462) unexpected end-of-file (perhaps the fastcgi process died): pid: 95332 socket: unix:/var/run/lighttpd/php-fastcgi.socket-0
2007-12-04 12:33:41: (mod_fastcgi.c.3269) response already sent out, but backend returned error on socket: unix:/var/run/lighttpd/php-fastcgi.socket-0 for /shop/continue.php , terminating connection
2007-12-04 12:49:45: (mod_fastcgi.c.2462) unexpected end-of-file (perhaps the fastcgi process died): pid: 95332 socket: unix:/var/run/lighttpd/php-fastcgi.socket-0
2007-12-04 12:49:45: (mod_fastcgi.c.3269) response already sent out, but backend returned error on socket: unix:/var/run/lighttpd/php-fastcgi.socket-0 for /shop/rwf.php , terminating connection

The PID quoted is always the PID of the parent php process (which has 16 worker children). 

Load is about 3 php-fastcgi requests per second.

Only a very small proportion of requests is affected. There appears to be no pattern in the url requested that triggers these errors (see log dump above).

In addition we are getting 

zend_mm_heap corrupted

printed on root's shell (presumably from the php-fastcgi process). These occur less often then the errors in lighty's log. 

Before we switched to lighttpd last week, we were getting apache segfaults at a similar frequency (perhaps a little lower).

We have played with the 
"PHP_FCGI_MAX_REQUESTS" => "5000"
from 100 to 10,000. makes no difference.

Very happy to work with someone to get detailed debug info, but will need some direction in how to do that under fastcgi.

issue appears to be related the unresolved:
http://pecl.php.net/bugs/bug.php?id=7141 and
http://pecl.php.net/bugs/bug.php?id=10142


System info
-----------

root@long# pkg_info  | grep -i light
lighttpd-1.4.18_1   A secure, fast, compliant, and very flexible Web Server

with php on fastcgi connecting to 
unix:/var/run/lighttpd/php-fastcgi.socket-0

actually php v 5.25 but that's not an option above:

root@long# php-cgi -v
PHP 5.2.5 (cgi-fcgi) (built: Nov 28 2007 17:22:04)
Copyright (c) 1997-2007 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2007 Zend Technologies

root@long# uname -a
FreeBSD 6.1-RELEASE-p10 amd64

Dual-Dual-core (ie 4cores) AMD Opterons

Configure Command =>  './configure'  '--with-layout=GNU' '--with-config-file-scan-dir=/usr/local/etc/php' '--disable-all' '--enable-libxml' '--with-libxml-dir=/usr/local' '--enabl
e-reflection' '--program-prefix=' '--enable-fastcgi' '--with-regex=php' '--with-zend-vm=CALL' '--disable-ipv6' '--prefix=/usr/local' '--mandir=/usr/local/man' '--infodir=/usr/loca
l/info/'

root@long# pkg_info  | grep -i apc
pecl-APC-3.0.15     Alternative PHP Cache

root@long# php -m
[PHP Modules]
apc
ctype
curl
date
dom
gd
gettext
hash
imap
json
libxml
mbstring
mcrypt
mysql
openssl
pcre
PDO
pdo_mysql
posix
pspell
Reflection
session
SimpleXML
sockets
SPL
standard
tidy
xml
xsl
zlib

[Zend Modules]

php.ini changes from "recommended"

# customized config
short_open_tag = On
display_errors = On
include_path = ".:/usr/local/share/pear/"
memory_limit = 64M      ; Maximum amount of memory a script may consume (8MB)

# to be removed later
register_globals = On
register_long_arrays = On
magic_quotes = On

# lighttpd 1.4.x cannot compress dynamic content, so do it here.
zlib.output_compression = On

# must use opcode caching
apc.enabled="1"
apc.shm_size="128"


Reproduce code:
---------------
no pattern 

Expected result:
----------------
no errors

Actual result:
--------------
don't have a backtrace yet... working on that. also going to definitvely prove that disabling APC eliminates the errors. 



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-12-04 08:29 UTC] oliver at realtsp dot com
additonal information

apc config (from phpinfo())

APC Support 	enabled
Version 	3.0.15
MMAP Support 	Enabled
MMAP File Mask 	no value
Locking type 	File Locks
Revision 	$Revision: 3.151 $
Build Date 	Nov 29 2007 17:43:14
 [2007-12-04 08:30 UTC] oliver at realtsp dot com
fixing description
 [2007-12-04 16:46 UTC] oliver at realtsp dot com
actually when i managed to turn off apc briefly (without causing server meltdown ;-) ) it turned out that the flow of errors continues. ie APC is not to blame.

i did find the resolution however:
http://bugs.php.net/bug.php?id=43295
http://bugs.php.net/bug.php?id=43476

and i patched my FreeBSD port accordinly with the 2 line diff here:
http://cvs.php.net/viewvc.cgi/php-src/main/SAPI.c?r1=1.202.2.7.2.15&r2=1.202.2.7.2.16&pathrev=PHP_5_2&diff_format=u 

the result was no errors at all...neither in the lighty log nor on root's console.

saved here for someone to google
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Oct 04 09:01:27 2024 UTC