Bug #50966 [Opn]: Some resource leak (odbc_connect and odbc_close) using dbase or Microsoft Acces
| From: | cmb@php.net | Date: | Tue, 11 Aug 2020 13:24:24 +0000 |
| Subject: | Bug #50966 [Opn]: Some resource leak (odbc_connect and odbc_close) using dbase or Microsoft Acces | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-228512@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=50966&edit=1
ID: 50966
Updated by: cmb@php.net
Reported by: gg dot cwlee at gmail dot com
Summary: Some resource leak (odbc_connect and odbc_close)
using dbase or Microsoft Acces
Status: Open
Type: Bug
-Package: ODBC related
+Package: OpenSSL related
Operating System: Windows XP
PHP Version: 5.2.12
Block user comment: N
Private report: N
New Comment:
Apparently, we're still using CRYPTO_set_id_callback() and
friends[1], although that API is deprecated as of OpenSSL 1.0.0 in
favor of CRYPTO_THREADID_set_callback()[2].
[1] <https://github.com/php/php-src/blob/php-8.0.0beta1/ext/curl/interface.c#L1169-L1182>
[2] <https://www.openssl.org/docs/man1.0.2/man3/CRYPTO_THREADID_set_callback.html>
Previous Comments:
------------------------------------------------------------------------
[2010-02-10 12:21:10] gg dot cwlee at gmail dot com
We identify the problem is within php_curl.dll. We are using PHP v5.2.12, and find that all newer
PHP versions have this problem. We have to backtrack to the older PHP v5.2.0 before this problem
disappears.
The problem source code:
PHP v5.2.12 ext\curl\interface.c Line 670
#ifdef PHP_CURL_NEED_OPENSSL_TSL
if (!CRYPTO_get_id_callback()) {
int i, c = CRYPTO_num_locks();
php_curl_openssl_tsl = malloc(c * sizeof(MUTEX_T));
PHP v5.2.0 ext\curl\interface.c Line 609
#ifdef PHP_CURL_NEED_OPENSSL_TSL
{
int i, c = CRYPTO_num_locks();
php_curl_openssl_tsl = malloc(c * sizeof(MUTEX_T));
The only difference is the if statement:
if (!CRYPTO_get_id_callback())
------------------------------------------------------------------------
[2010-02-08 11:19:30] gg dot cwlee at gmail dot com
Description:
------------
We have a resource leak problem when using Apache 2.2.11 and PHP 5.2.12 with odbc_connect() and
odbc_close() functions on dbase or Microsoft Access.
From my observe, it will leak some (Nonpaged) kernel Memory and some handles not free by the
Apache(HTTPD.EXE).
And I also tested no this resource leak problem on Apache 2.2.11 and PHP 5.2.0.
Thanks.
Chris
Reproduce code:
---------------
<?php
$dsnMDB = "DRIVER=Microsoft Access Driver
(*.mdb);UID=admin;UserCommitSync=Yes;Threads=3;SafeTransactions=0;PageTimeout=5;MaxScanRows=8;MaxBufferSize=2048;FIL=MS
Access;DriverId=25;DefaultDir=D:\;DBQ=D:\db1.mdb;";
$dsnDBF = "DRIVER=Microsoft dBase Driver
(*.dbf);UID=admin;UserCommitSync=Yes;Threads=3;Statistics=0;SafeTransactions=0;PageTimeout=5;MaxScanRows=8;MaxBufferSize=2048;FIL=dBase
IV;DriverId=277;Deleted=1;DefaultDir=D:\;DBQ=D:\datasource\;CollatingSequence=ASCII;";
$dsn= $dsnDBF;
$userDB=odbc_connect($dsn,"","");
odbc_close($userDB);
?>
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=50966&edit=1