php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32475 ["PATCH"] Memory Leak: TSRMLS_FETCH() in HTTPExtensionProc
Submitted: 2005-03-28 17:29 UTC Modified: 2005-11-18 10:31 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: lacey at lacey dot cc Assigned: dmitry (profile)
Status: Closed Package: IIS related
PHP Version: 5CVS-2005-11-17 (snap) OS: Windows XP
Private report: No CVE-ID: None
 [2005-03-28 17:29 UTC] lacey at lacey dot cc
Description:
------------
Memory Leak using the php5isapi.dll under IIS.  When TSRMLS_FETCH() is called from HTTPExtensionProc, ts_free_thread leaves a Memory Leak of approximately 100K for every call.  When TSRMLS_FETCH() isn't called, there's no leak.  This leak will crash a Server under light loads within a few hours.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-03-29 01:53 UTC] lacey at lacey dot cc
Yes.  Of course I will download those and do more testing.  I'll let you know if I find out anything further.  But I've already given you the exact subroutine.  It's the call to TSRMLS_FETCH() which calls ts_resource_ex in trsm.c

ts_resouce_ex allocates the memory, and ts_free_thread somehow doesn't free it all.  The memory keeps growing with the implementation of each thread until the Server crashes.  I'd assume that's where you need to look.  Or am I missing something here?

Jakub has explained the same scenario in this report as well.

http://bugs.php.net/bug.php?id=23331

Thanks.
 [2005-11-17 21:12 UTC] sniper@php.net
This is the "patch" to fix this, according to the reportee

static void executor_globals_dtor(zend_executor_globals
*executor_globals TSRMLS_DC)
{
	zend_ini_shutdown(TSRMLS_C);
	zend_shutdown_constants(TSRMLS_C);
}

Dmitry, can you check this out, if it makes any sense. 

 [2005-11-18 00:41 UTC] lacey at lacey dot cc
Hang on.  I've downloaded the latest version for the second time today and the ISAPI seems to be working for a few hours without growing in memory.  Did you Guys change something today?  I'll keep testing that and let you know.  The CGI was still leaking memory though.  (at 4K per hit)
 [2005-11-18 10:25 UTC] sniper@php.net
Apparently the part you referred to has already been fixed.
The CGI issue is something else. And propably just inherent with the fact that CGI requests are one time only things, usually..

 [2005-11-18 10:31 UTC] dmitry@php.net
Seems this bug was already fixed in CVS HEAD and PHP_5_1 long time ago (not in PHP_5_0 and PHP_4_4).

http://cvs.php.net/diff.php/ZendEngine2/zend.c?r1=1.308&r2=1.308.2.1&ty=u

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 03:01:28 2024 UTC