#24390 [Ver->Csd]: persistent resources destructors aren't called when ZTS is enabled.
| From: | sniper@php.net | Date: | Mon, 15 Mar 2004 13:43:52 +0000 |
| Subject: | #24390 [Ver->Csd]: persistent resources destructors aren't called when ZTS is enabled. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-56476@lists.php.net to get a copy of this message | ||
ID: 24390
Updated by: sniper@php.net
Reported By: vaclav dot pecuch at tiscali dot cz
-Status: Verified
+Status: Closed
Bug Type: Scripting Engine problem
Operating System: any (+ ZTS)
PHP Version: 4CVS, 5CVS
New Comment:
This bug has been fixed in CVS.
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/.
Thank you for the report, and for helping us make PHP better.
Previous Comments:
------------------------------------------------------------------------
[2004-02-26 15:30:49] sniper@php.net
The MSHUTDOWN _is_ called in both zts/non-zts modes.
------------------------------------------------------------------------
[2004-02-26 15:29:57] sniper@php.net
See also bug #27185 (these two are propably same issue)
------------------------------------------------------------------------
[2003-07-27 12:31:39] iliaa@php.net
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] sniper@php.net
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