From:             
Operating system: DebianLenny2.6.26-2-openvz-amd64
PHP version:      5.3.3
Package:          FPM related
Bug Type:         Bug
Bug description:Misconfigured Sendmail sends PHP-FPM into an infinite loop

Description:
------------
(Misconfigured) Sendmail sends PHP-FPM into an infinite loop of
spawning/exiting worker processes when attempting to send an email through
the mail() function. (The php script itself just times out without any
output.)



Since this loop produces 100% cpu load and warnings AND logs these
warnings, the log file has grown to 400MB+ before I noticed the load spike
and stopped PHP-FPM master process with kill -9 PID (nothing else worked
e.g. -QUIT).



After I purge-removed the Sendmail package and installed Postfix instead,
everything is working as it should (I didn't made any changes to
nginx/php-fpm/php config files whatsoever).





Server: nginx-0.8.47

PHP ini settings related to mail: "sendmail_path = /usr/sbin/sendmail -t
-i"

Sendmail state: daemon was not running (sendmail process was called, it did
it's work i.e. nothing, then exited)

PHP configure:

./configure --prefix=/usr --enable-fpm --disable-rpath --with-pear
--disable-debug --with-openssl --with-pcre-regex --with-zlib
--enable-bcmath --with-bz2 --enable-calendar --with-curl --enable-exif
--enable-inline-optimization --with-gd --enable-gd-native-ttf
--with-gettext --with-imap --with-imap-ssl --with-kerberos --with-ldap
--enable-mbstring --enable-mbregex --with-mcrypt --with-mysql --with-mysqli
--enable-pcntl --enable-pdo --with-pdo-firebird --with-pdo-mysql
--with-pdo-pgsql --with-pgsql --enable-shmop --enable-soap --enable-sockets
--enable-sqlite-utf8 --enable-sysvmsg --enable-sysvsem --enable-sysvshm
--with-tidy --enable-wddx --with-xmlrpc --with-xsl --enable-zip --with-pic
--enable-ftp --enable-dom --enable-xmlwriter --enable-xmlreader
--enable-tokenizer --enable-simplexml --enable-session --enable-posix
--enable-phar --enable-libxml --enable-json --with-iconv --enable-filter
--enable-fileinfo --enable-dba --enable-ctype

Dynamic extensions:

pecl apc-beta (apc.so) and rar (rar.so).

Changed PHP-FPM settings: 

listen = /var/run/php-fpm/php-fpm.sock

listen.owner = www-data

listen.group = www-data

user = www-data

group = www-data

pm = dynamic

pm.max_children = 10

pm.start_servers = 4

pm.min_spare_servers = 3

pm.max_spare_servers = 6

request_terminate_timeout = 60

rlimit_files = 10240

chdir = /var/www

catch_workers_output = yes





Test script:
---------------
$to  = 'x...@abc.com';



// subject

$subject = 'Birthday Reminders for August';



// message

$message = '

<html>

<head>

  <title>Birthday Reminders for August</title>

</head>

<body>

  <p>Here are the birthdays upcoming in August!</p>

  <table>

    <tr>

      <th>Person</th><th>Day</th><th>Month</th><th>Year</th>

    </tr>

    <tr>

      <td>Joe</td><td>3rd</td><td>August</td><td>1970</td>

    </tr>

    <tr>

      <td>Sally</td><td>17th</td><td>August</td><td>1973</td>

    </tr>

  </table>

</body>

</html>

';



// To send HTML mail, the Content-type header must be set

$headers  = 'MIME-Version: 1.0' . "\r\n";

$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";



// Additional headers

$headers .= 'To: Dude Dudeson <x...@abc.com>, Kelly <ke...@gals.com>' .
"\r\n";

$headers .= 'From: Birthday Reminder <x...@abc.com>' . "\r\n";

$headers .= 'Cc: topstal...@thehomeofallinternetpredators.com' . "\r\n";



// Mail it

if (mail($to, $subject, $message, $headers)) echo "OKAY!!!!!";

Expected result:
----------------
OKAY!!!!!

Actual result:
--------------
php-fpm error log:



...

Trying to run a mail script

...



Jul 28 11:42:20.169022 [WARNING] [pool www] child 6344, script
'/var/www/xyz.com/public/mail.php' execution timed out (60.095817 sec),
terminating

Jul 28 11:42:20.169719 [WARNING] [pool www] child 6344 exited on signal 15
SIGTERM after 1532.840955

 seconds from start

Jul 28 11:42:20.170087 [NOTICE] [pool www] child 6409 started

Jul 28 11:42:20.170752 [WARNING] [pool www] child 6409 exited on signal 11
SIGSEGV after 0.000681 seconds from start

Jul 28 11:42:20.171011 [NOTICE] [pool www] child 6410 started

Jul 28 11:42:20.171602 [WARNING] [pool www] child 6410 exited on signal 11
SIGSEGV after 0.000605 seconds from start



...

Gazillion lines

...

I've noticed it's killing my cpus and tried to kill it

...

...



Jul 28 12:01:45.644600 [NOTICE] [pool www] child 2017 started

Jul 28 12:01:45.644615 [WARNING] [pool www] child 2011 exited on signal 6
SIGABRT after 0.002469 seconds from start

Jul 28 12:01:45.644621 [WARNING] [pool www] child 2011 said into stderr: 
"php-fpm: event.c:261: event_base_free: Assertion
`(((&base->eventqueue)->tqh_first) == ((void *)0))' failed."

Jul 28 12:01:45.645047 [NOTICE] [pool www] child 2018 started

Jul 28 12:01:45.645062 [WARNING] [pool www] child 2012 exited on signal 6
SIGABRT after 0.002622 seconds from start

Jul 28 12:01:45.645071 [WARNING] [pool www] child 2012 said into stderr:
"php-fpm: event.c:261: event_base_free: Assertion
`(((&base->eventqueue)->tqh_first) == ((void *)0))' failed."

Jul 28 12:01:45.646422 [NOTICE] [pool www] child 2021 started

Jul 28 12:01:45.646438 [WARNING] [pool www] child 2013 exited on signal 6
SIGABRT after 0.003529 seconds from start

Jul 28 12:01:45.646444 [WARNING] [pool www] child 2013 said into stderr:
"php-fpm: event.c:261: event_base_free: Assertion
`(((&base->eventqueue)->tqh_first) == ((void *)0))' failed."

-- 
Edit bug report at http://bugs.php.net/bug.php?id=52501&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=52501&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=52501&r=trysnapshot53
Try a snapshot (trunk):              
http://bugs.php.net/fix.php?id=52501&r=trysnapshottrunk
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=52501&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=52501&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=52501&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=52501&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=52501&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=52501&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=52501&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=52501&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=52501&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=52501&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=52501&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=52501&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=52501&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=52501&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=52501&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=52501&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=52501&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=52501&r=mysqlcfg

Reply via email to