php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #59906 APC crashes Apache on Graceful Restart (Windows)
Submitted: 2011-08-20 17:50 UTC Modified: 2011-09-14 05:27 UTC
From: user7 at mailinator dot com Assigned: pajoye (profile)
Status: Closed Package: APC (PECL)
PHP Version: 5.3.6 OS: Windows Vista SP1
Private report: No CVE-ID: None
 [2011-08-20 17:50 UTC] user7 at mailinator dot com
Description:
------------
httpd -k restart

Will crash Apache 2.2.19 (on Vista SP1) when using...

1. APC 3.1.9 built with PHP 5.3.7 (configure ... --enable-apc=shared --enable-apc-srwlock-kernel)

APC Version 3.1.9 
PHP Version 5.3.7 
APC Host serverhost (xxx) (127.0.0.1) 
Server Software Apache/2.2.19 (Win32) mod_ssl/2.2.19 OpenSSL/0.9.8r PHP/5.3.7 
Shared Memory 1 Segment(s) with 64.0 MBytes 
(IPC shared memory, Windows Slim RWLOCK (kernel) locking)  

Problem signature:
  Problem Event Name:	APPCRASH
  Application Name:	httpd.exe
  Application Version:	2.2.19.0
  Fault Module Name:	ntdll.dll


2. Using php_apc-3.1.8-dev+igbinary-1.1.2-dev-20110321-5.3-ts-vc9-x86.zip, php_apc-xp.dll

Problem signature:
  Problem Event Name:	APPCRASH
  Application Name:	httpd.exe
  Application Version:	2.2.19.0
  Fault Module Name:	ntdll.dll

APC Version 3.1.8-dev 
PHP Version 5.3.7 
APC Host serverhost (Q6600) (127.0.0.1) 
Server Software Apache/2.2.19 (Win32) mod_ssl/2.2.19 OpenSSL/0.9.8r PHP/5.3.7 
Shared Memory 1 Segment(s) with 64.0 MBytes 
(IPC shared memory, Windows Slim RWLOCK (kernel) locking)  


Will *not* crash Apache 2.2.19 (on Vista SP1) when using...

1. Using pierre's php_apc-3.1.8-dev+igbinary-1.1.2-dev-20110321-5.3-ts-vc9-x86.zip, php_apc-win7.dll

APC Version 3.1.8-dev 
PHP Version 5.3.7 
APC Host serverhost (xxx) (127.0.0.1) 
Server Software Apache/2.2.19 (Win32) mod_ssl/2.2.19 OpenSSL/0.9.8r PHP/5.3.7 
Shared Memory 1 Segment(s) with 64.0 MBytes 
(IPC shared memory, Windows Slim RWLOCK (native) locking)  


This also happens with PHP 5.3.6, and previous versions of Apache.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-08-20 18:00 UTC] user7 at mailinator dot com
httpd -k restart

Will crash Apache 2.2.19 (on Vista SP1) when using...


1. APC 3.1.9 built with PHP 5.3.7 (configure ... --enable-apc=shared --enable-apc-srwlock-kernel)

APC Version 3.1.9 
PHP Version 5.3.7 
APC Host serverhost (xxx) (127.0.0.1) 
Server Software Apache/2.2.19 (Win32) mod_ssl/2.2.19 OpenSSL/0.9.8r PHP/5.3.7 
Shared Memory 1 Segment(s) with 64.0 MBytes 
(IPC shared memory, Windows Slim RWLOCK (kernel) locking)  

Problem signature:
  Problem Event Name:	APPCRASH
  Application Name:	httpd.exe
  Application Version:	2.2.19.0
  Fault Module Name:	ntdll.dll


2. Using pierre's php_apc-xp.dll from php_apc-3.1.8-dev+igbinary-1.1.2-dev-20110321-5.3-ts-vc9-x86.zip

APC Version 3.1.8-dev 
PHP Version 5.3.7 
APC Host serverhost (xxx) (127.0.0.1) 
Server Software Apache/2.2.19 (Win32) mod_ssl/2.2.19 OpenSSL/0.9.8r PHP/5.3.7 
Shared Memory 1 Segment(s) with 64.0 MBytes 
(IPC shared memory, Windows Slim RWLOCK (kernel) locking)  

Problem signature:
  Problem Event Name:	APPCRASH
  Application Name:	httpd.exe
  Application Version:	2.2.19.0
  Fault Module Name:	ntdll.dll



Will *not* crash Apache 2.2.19 (on Vista SP1) when using...


1. Using pierre's php_apc-win7.dll from php_apc-3.1.8-dev+igbinary-1.1.2-dev-20110321-5.3-ts-vc9-x86.zip

APC Version 3.1.8-dev 
PHP Version 5.3.7 
APC Host serverhost (xxx) (127.0.0.1) 
Server Software Apache/2.2.19 (Win32) mod_ssl/2.2.19 OpenSSL/0.9.8r
PHP/5.3.7 
Shared Memory 1 Segment(s) with 64.0 MBytes 
(IPC shared memory, Windows Slim RWLOCK (native) locking)  



This also happens with PHP 5.3.6, and previous versions of Apache.
 [2011-09-13 01:12 UTC] Brian dot White at foxfire74 dot com
This happens because the WINAPI function RtlDeleteResource MUST be called with a valid lock and there is a typo (#ifdef should be #if) in the apc_cache.c so that it always tries to release OS resources used for the non-blocking lock.  But since it was never initialized in apc_cache_create there is an exception access violation.  The other lock types work whether or not the lock is a valid lock structure.  A patch to correct this is attached; however, APC still fails on restart when PHP is run as an Apache module on Windows because of a race condition on shutdown between the parent and child processes.  Both processes call DESTROY_LOCK which in is a wrapper for RtlDeleteResource when windows kernel locking is enabled.  The first one succeeds, the second one fails for the same reason as above.  I have created a patch which fixes that issue and will attach it to a separate bug report.

--- W:/TEMP/APC-3.1.9/apc_cache.c	Sat May 14 18:14:56 2011
+++ W:/php-sdk/php53dev/vc9/x86/php-5.3.8/ext/apc/apc_cache.c	Mon Sep 12 22:00:00 2011
@@ -314,7 +314,7 @@
 void apc_cache_destroy(apc_cache_t* cache TSRMLS_DC)
 {
     DESTROY_LOCK(cache->header->lock);
-#ifdef NONBLOCKING_LOCK_AVAILABLE
+#if NONBLOCKING_LOCK_AVAILABLE
     DESTROY_LOCK(cache->header->wrlock);
 #endif
     apc_efree(cache TSRMLS_CC);
 [2011-09-14 05:27 UTC] at php dot net
This bug has been fixed in SVN.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.

Thanks for your patch and feedback!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 23:01:26 2024 UTC