Edit report at http://bugs.php.net/bug.php?id=52086&edit=1

 ID:               52086
 Updated by:       f...@php.net
 Reported by:      admin at saltwaterc dot net
 Summary:          No new line at the end of a included pool file crahes
                   the PHP FPM daemon
-Status:           Analyzed
+Status:           Closed
 Type:             Bug
 Package:          FPM related
 Operating System: *
 PHP Version:      5.3.2
 Assigned To:      fat

 New Comment:

This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.




Previous Comments:
------------------------------------------------------------------------
[2010-06-19 18:31:21] f...@php.net

Automatic comment from SVN on behalf of fat
Revision: http://svn.php.net/viewvc/?view=revision&revision=300604
Log: - Fixed bug #52086 (No new line at the end of a included file
crahes the PHP FPM daemon)

------------------------------------------------------------------------
[2010-06-19 17:58:43] admin at saltwaterc dot net

service php-fpm restart

Gracefully shutting down php-fpm  done

Starting php-fpm PHP:  syntax error, unexpected $end in Unknown on line
1

Jun 19 15:50:58.956049 [ERROR] Unable to include 

/usr/local/zend/etc/fpm.d/default.conf from 

/usr/local/zend/etc/php-fpm.conf at line 8

Jun 19 15:50:58.956439 [ERROR] failed to load configuration file 

'/usr/local/zend/etc/php-fpm.conf'

 failed





It doesn't dump the backtrace and the memory map, but it still crashes.
I made a PHP script that writes the configuration to 

/usr/local/zend/etc/fpm.d/:



#!/usr/local/zend/bin/php

<?php

file_put_contents

(

"/usr/local/zend/etc/fpm.d/default.conf",

"[default]

user = php-fpm

group = php-fpm

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

pm = static

pm.max_children = 2

pm.max_requests = 10000

chdir = /var/www"

);



This reproduces the bug. If I manually edit the file with nano,
everything is fine since nano automatically adds a new line 

at the end of the last line.

------------------------------------------------------------------------
[2010-06-15 17:08:02] f...@php.net

Can you try the attached patch please ?

------------------------------------------------------------------------
[2010-06-15 17:07:25] f...@php.net

The following patch has been added/updated:

Patch Name: fpm-include.error.patch
Revision:   1276614445
URL:       
http://bugs.php.net/patch-display.php?bug=52086&patch=fpm-include.error.patch&revision=1276614445

------------------------------------------------------------------------
[2010-06-15 14:49:38] admin at saltwaterc dot net

Description:
------------
I have a script that automatically generates pool configurations based
on input parameters and a template configuration. It didn't used to
place a new line at the end of the generated configuration file which
degenerated into a hard to debug error as the daemon crashes without any
useful explanation. By adding a new line after the last configuration
line (in my example, php_admin_value[upload_tmp_dir] =
/home/example.com/tmp) everything works as expected.

Test script:
---------------
[example.com]

user = example.com

group = example.com

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

pm = static

pm.max_children = 2

pm.max_requests = 10000

slowlog = /home/example.com/logs/fpm/slow.log

chdir = /home/example.com/docroot

php_admin_value[error_log] = /home/example.com/logs/fpm/error.log

php_admin_value[open_basedir] =
/home/example.com/docroot:/home/example.com/sessions:/home/example.com/tmp

php_admin_value[session.save_path] = /home/example.com/sessions

php_admin_value[upload_tmp_dir] = /home/example.com/tmp

Expected result:
----------------
Successful PHP FPM daemon start.

Actual result:
--------------
Starting php-fpm PHP:  syntax error, unexpected $end in Unknown on line
1

Jun 15 12:35:12.090707 [ERROR] Unable to include
/usr/local/zend/etc/fpm.d/example.com.ini from
/usr/local/zend/etc/php-fpm.conf at line 23

*** glibc detected *** /usr/local/zend/sbin/php-fpm: double free or
corruption (fasttop): 0x000000001ac80380 ***

+ backtrace

+ memory map


------------------------------------------------------------------------



-- 
Edit this bug report at http://bugs.php.net/bug.php?id=52086&edit=1

Reply via email to