Bug #79310 [Opn->Sus]: ibase_fetch_* makes server crashes because of out of memory

From: Date: Wed, 31 Mar 2021 11:42:11 +0000
Subject: Bug #79310 [Opn->Sus]: ibase_fetch_* makes server crashes because of out of memory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233098@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79310&edit=1 ID: 79310 Updated by: cmb@php.net Reported by: nicolasv dot poubelle at gmail dot com Summary: ibase_fetch_* makes server crashes because of out of memory -Status: Open +Status: Suspended Type: Bug Package: InterBase related Operating System: debian 10 PHP Version: 7.3.15 Block user comment: N Private report: N New Comment: The interbase extension is moved to PECL[1] as of PHP 7.4.0, and is looking for a new maintainer. Until a new maintainer is found, I suspend this ticket. Consider to use the bundled PDO_Firebird extension, or the php-firebird package[2] instead. [1] <https://pecl.php.net/package/interbase> [2] <https://github.com/FirebirdSQL/php-firebird> Previous Comments: ------------------------------------------------------------------------ [2020-02-26 22:21:06] nicolasv dot poubelle at gmail dot com / ------------------------------------------------------------------------ [2020-02-26 22:18:45] nicolasv dot poubelle at gmail dot com Description: ------------ Hello everyone, We have an old PHP application we want to upgrade from PHP 5.6 to PHP 7.3. The database is managed by a Firebird server. We found a weird behaviour with PHP Interbase extension (PHP 7.3.15), and before qualify it as a bug, I wanted to know if other people had the same issue. - ibase_connect to database - create an array of ~200 queries (with INNER JOIN on some big tables) - make a call to ibase_query - make a call to ibase_fetch_* (no need to fetch all rows) If you take care about the Firebird server memory usage, it will increase by ~5MB for each queries, without releasing memory. But if you make a call to ibase_free_result just after the call of ibase_fetch, memory is released on *server* side. I tried to search in source code, problem seems to be about the call of isc_dsql_fetch, but I can't find any relevant difference between 5.6 source code and 7.3. https://github.com/php/pecl-database-interbase/blob/master/ibase_query.c#L1476 Thanks by advance! Test script: --------------- ibase_connect('...'); $arr = array(/* queries on our firebird server */); foreach ($arr as $query) { $res = ibase_query($query); ibase_fetch_assoc($res); //if you make a call at ibase_free_result($res), memory on firebird server is released } Expected result: ---------------- With PHP 5.6, the call of ibase_free_result isn't needed (memory usage is stable). Actual result: -------------- Memory usage on firebird server increases until server crashes: In firebird.log : SERVER/process_packet: out of memory fbserver.exe: terminated abnormally (3221225477) In PHP script : Error reading data from the connection ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79310&edit=1

« previous php.bugs (#233098) next »