Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26395 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3326 invoked by uid 1010); 7 Nov 2006 08:00:53 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 3310 invoked from network); 7 Nov 2006 08:00:53 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Nov 2006 08:00:53 -0000 Received: from [127.0.0.1] ([127.0.0.1:19159]) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ECSTREAM id 3C/91-34853-92D30554 for ; Tue, 07 Nov 2006 03:00:41 -0500 Authentication-Results: pb1.pair.com header.from=isk@ecommerce.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=isk@ecommerce.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain ecommerce.com from 80.121.204.32 cause and error) X-PHP-List-Original-Sender: isk@ecommerce.com X-Host-Fingerprint: 80.121.204.32 mail.ecommerce.com Linux 2.4/2.6 Received: from [80.121.204.32] ([80.121.204.32:51514] helo=mail.ecommerce.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 46/51-34853-8B930554 for ; Tue, 07 Nov 2006 02:46:02 -0500 Received: (qmail 16537 invoked by uid 399); 7 Nov 2006 08:05:04 -0000 Received: from unknown (HELO ?10.2.44.119?) (80.121.204.1) by mail.opentransfer.com with SMTP; 7 Nov 2006 08:05:04 -0000 To: internals@lists.php.net Date: Tue, 7 Nov 2006 09:45:55 +0200 User-Agent: KMail/1.9.3 MIME-Version: 1.0 Content-Type: Multipart/Mixed; boundary="Boundary-00=_zmDUFZphCIEthbN" Message-ID: <200611070945.55739.isk@ecommerce.com> Subject: [PATCH] register shutdown actions for apache child die From: isk@ecommerce.com (Olexander Shtepa) --Boundary-00=_zmDUFZphCIEthbN Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Content-Disposition: inline apache2handler sapi registers cleanup functions only for main apache process. But apache 2 cleans _only_ child pool before it die. This is reason for unclean connection closes in persistent connection (in pgsql exactly). This patch adds shutdown actions registration on each child init. Apache child will be call php_apache_server_shutdow() before it die like handler for Apache 1.3. This patch closes bug #39330. --Boundary-00=_zmDUFZphCIEthbN Content-Type: text/x-diff; charset="us-ascii"; name="child_exit.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="child_exit.patch" Index: sapi/apache2handler/sapi_apache2.c =================================================================== RCS file: /repository/php-src/sapi/apache2handler/sapi_apache2.c,v retrieving revision 1.75 diff -u -r1.75 sapi_apache2.c --- sapi/apache2handler/sapi_apache2.c 23 Oct 2006 19:17:51 -0000 1.75 +++ sapi/apache2handler/sapi_apache2.c 7 Nov 2006 07:26:44 -0000 @@ -414,6 +414,11 @@ return OK; } +static void php_apache_child_init(apr_pool_t *pchild, server_rec *s) +{ + apr_pool_cleanup_register(pchild, NULL, php_apache_server_shutdown, apr_pool_cleanup_null); +} + static apr_status_t php_server_context_cleanup(void *data_) { void **data = data_; @@ -631,6 +636,7 @@ { ap_hook_pre_config(php_pre_config, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_post_config(php_apache_server_startup, NULL, NULL, APR_HOOK_MIDDLE); + ap_hook_child_init(php_apache_child_init, NULL, NULL, APR_HOOK_MIDDLE); ap_hook_handler(php_handler, NULL, NULL, APR_HOOK_MIDDLE); } --Boundary-00=_zmDUFZphCIEthbN--