ID: 24390 Updated by: [EMAIL PROTECTED] Reported By: vaclav dot pecuch at tiscali dot cz Status: Verified Bug Type: Scripting Engine problem Operating System: any (+ ZTS) PHP Version: 4CVS, 5CVS New Comment:
See also bug #27185 (these two are propably same issue) Previous Comments: ------------------------------------------------------------------------ [2003-07-27 12:31:39] [EMAIL PROTECTED] Not only do the persistent resources destructors are not called, but the MSHUTDOWN is also not called resulting in quite a few memory leaks. ------------------------------------------------------------------------ [2003-06-29 21:07:00] [EMAIL PROTECTED] This is not Windows specific, but ZTS issue. The persistant resource destructor is not called at all when ZTS is enabled. (tested using CLI compiled with ZTS enabled) Test sources found here (a bit cleaned up version): http://www.php.net/~jani/ext_tm.tar.gz Configure php: # ./configure --disable-all --disable-cgi --enable-tm --enable-experimental-zts Test results: ----------------------------------------------------------- Thread Safety => disabled resource(4) of type (TestModule Resource) TestModule (normal): resource "non-persistent resource" created (non-persistent) Running tm_resource_dtor() for resource "non-persistent resource" resource(4) of type (TestModule Persistent Resource) TestModule (persistent): resource "persistent resource" created (persistent): Running tm_presource_dtor() for resource "persistent resource" ----------------------------------------------------------- Thread Safety => enabled resource(4) of type (TestModule Resource) TestModule (normal): resource "non-persistent resource" created (non-persistent) Running tm_resource_dtor() for resource "non-persistent resource" resource(4) of type (TestModule Persistent Resource) TestModule (persistent): resource "persistent resource" created -------------------------------------- ------------------------------------------------------------------------ [2003-06-29 14:54:01] vaclav dot pecuch at tiscali dot cz Description: ------------ PHP 4.3.2 on Windows doesn't call persistent resource destructors on PHP process shutdown. I'm using persitent resources in my PHP module, i.e. in MINIT function I register destructors for my resources: mymod_rsc=zend_register_list_destructors_ex(mymod_commit_rsc, mymod_close_rsc, MYMOD_RSC_NAME, module_number); I add newly created resource to EG(persistent_list) by this code list_entry new_le; Z_TYPE(new_le) = mymod_rsc; new_le.ptr = malloced_rsc_data_buffer; zend_hash_update(&EG(persistent_list), hashed_details, strlen(hashed_details)+1, (void *) &new_le, sizeof(list_entry), NULL); Function mymod_commit_rsc is called at the end of the request while mymod_close_rsc is never called. I'm running PHP 4.3.2 with Apache 1.3.27 (PHP runs as Apache module) on Windows 2000. I'm loading PHP module through "extension" directive in PHP.INI. I've tested my module on Linux (RH 7.3, PHP 4.3.2 as Apache module with Apache 1.3.27) and it worked - mymod_close_rsc was called at the end of PHP process or more precisely at the end of Apache process. Reproduce code: --------------- The simplest example is there: http://home.tiscali.cz/vaclav.pecuch/phptestmodule.zip This is PHP module which registers its persistent resource in MINIT function, implements "create_resource" function and contains some logging (ugly but functional). Change path settings in makefile and logfile path and filename in C source before build. Expected result: ---------------- Destruction of persistent resources at the end of PHP process. Actual result: -------------- Destructor isn't called on Windows, is called on Linux. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=24390&edit=1