Bug #79310 [NEW]: ibase_fetch_* makes server crashes because of out of memory

From: Date: Wed, 26 Feb 2020 22:18:45 +0000
Subject: Bug #79310 [NEW]: ibase_fetch_* makes server crashes because of out of memory
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225738@lists.php.net to get a copy of this message
From: nicolas dot vannier at dunordausud dot fr Operating system: debian 10 PHP version: 7.3.15 Package: InterBase related Bug Type: Bug Bug description:ibase_fetch_* makes server crashes because of out of memory 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 bug report at https://bugs.php.net/bug.php?id=79310&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79310&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79310&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79310&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79310&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79310&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79310&r=support Expected behavior: https://bugs.php.net/fix.php?id=79310&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79310&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79310&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79310&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79310&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79310&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79310&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79310&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79310&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79310&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79310&r=mysqlcfg

« previous php.bugs (#225738) next »