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
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: dylan dot arnold at gmail dot com
New email:
PHP Version: OS:

 

 [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

Add a Patch

Pull Requests

Add a Pull Request

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-2018 The PHP Group
All rights reserved.
Last updated: Thu Nov 15 03:01:25 2018 UTC