Bug #32099 [Com]: After opening ADO connection and closing it repeatedly, Apache stops service

From: Date: Fri, 22 Apr 2011 23:20:45 +0000
Subject: Bug #32099 [Com]: After opening ADO connection and closing it repeatedly, Apache stops service
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-160340@lists.php.net to get a copy of this message
Edit report at http://bugs.php.net/bug.php?id=32099&edit=1 ID: 32099 Comment by: thangaraj at gmail dot com Reported by: terryoh at wins21 dot com Summary: After opening ADO connection and closing it repeatedly, Apache stops service Status: Assigned Type: Bug Package: COM related Operating System: win32 PHP Version: 5CVS, 4CVS (2005-02-28) Assigned To: wez Block user comment: N Private report: N New Comment: I faced a similar crash in my App, fixed the COM issue and was trying to post it as a new bug, somehow PHP bug system smartly pointed out this defect. Tested my fix on the sample script and PHP doesn't crash. Therefore uploading patch here. This crash is reproducible in old and latest SVN builds too. OS : WindowsServer 2003 R2 EE SP2 x86 PHP Version : 5.3.6 NTS build or below in fast cgi mode. Web Server : Apache 2.2.16 / mod_fcgid 2.3.5 DBMS : MSSQL 2005 Enterprise Edition OTHERS : MDAC 2.8 Root Cause: ~~~~~~~~~~~ When PHP fastcgi engine Initializes and Shuts down ADO COM objects fastly within a second, Crash happens, i.e., Comsvcs.dll PingThread method access violates and crashes php-cgi.exe Patch provided: ~~~~~~~~~~~~~~~ PHP non Thread safe builds using "fast cgi mode" is made to cache COM CoInit call and release COM subsystem only during php-cgi.exe process shutdown. By not calling CoUnint during every request shutdown, Comsvcs.dll is not unloaded and PingThread method does not access violate. Note that MS recommends to use CoUnint API during process shutdown, and this patch does it. [PATCH uploaded] ~~~~~~~~~~~~~~~~ DIFF of 5.3SVN-2011-04-22 Patch_for_PhpCrashInFCGIModeDuringCoUnintialzie.diff -Thanga Previous Comments: ------------------------------------------------------------------------ [2005-03-19 00:08:01] sniper@php.net We don't know a solution, sorry. ------------------------------------------------------------------------ [2005-03-02 09:43:22] terryoh at wins21 dot com In my test, PHP 5 has same problem. I really want to know the solution, please.. ------------------------------------------------------------------------ [2005-03-02 08:23:50] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php5-latest.tar.gz For Windows: http://snaps.php.net/win32/php5-win32-latest.zip This is PHP 5 snapshot which has better COM support. ------------------------------------------------------------------------ [2005-02-28 02:43:18] terryoh at wins21 dot com I downloaded the latest php. http://snaps.php.net/win32/php4-win32-STABLE-latest.zip After upgrading the php module, I tried the same test. But the result was same. Memory and the count of the handles were increased. After the session.gc_maxlifetime(php.ini), the result was same. [Presumption] I read something about zend engine on a webpage(I can't remeber the web address exactly), it is that the zend engine doesn't release database connection to reuse exceptionally. It might be this process causes trouble between ADO and Zend engine. ------------------------------------------------------------------------ [2005-02-25 14:20:25] sniper@php.net Please try using this CVS snapshot: http://snaps.php.net/php4-STABLE-latest.tar.gz For Windows: http://snaps.php.net/win32/php4-win32-STABLE-latest.zip ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/bug.php?id=32099 -- Edit this bug report at http://bugs.php.net/bug.php?id=32099&edit=1

« previous php.bugs (#160340) next »