php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61231 Module shutdown only executed for parent process
Submitted: 2012-03-02 00:51 UTC Modified: 2013-10-27 17:59 UTC
From: dylan dot arnold at gmail dot com Assigned: fat (profile)
Status: Closed Package: FPM related
PHP Version: 5.4.0 OS: all
Private report: No CVE-ID: None
 [2012-03-02 00:51 UTC] dylan dot arnold at gmail dot com
Description:
------------
When a php-fpm child process shuts down it does not call module shutdown.

Check out sapi/fpm/fpm/fpm_main.c line 1917 in out:

    if (parent) {
        php_module_shutdown(TSRMLS_C);
        sapi_shutdown();
    }

I'm pretty sure this should be 

    php_module_shutdown(TSRMLS_C);
    if (parent) {
        sapi_shutdown();
    }

This caused us problems in our custom PHP extension because we need to clean up 
when a child exits, closing 
sockets and freeing resources.

Thanks.

Patch attached

patch sapi/fpm/fpm/fpm_main.c fpm_child_mshutdown.patch


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-03-06 04:52 UTC] laruence@php.net
-Assigned To: +Assigned To: fat
 [2013-10-27 17:59 UTC] tony2001@php.net
-Status: Assigned +Status: Closed
 [2013-10-27 17:59 UTC] tony2001@php.net
The fix for this bug has been committed.

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/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Fixed in this commit:
https://github.com/php/php-src/commit/a911fbc80a8e29aa1d58d8e8a86c4fa3f6c7bf92
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC