|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19155 fbsql_free_result() must be used
Submitted: 2002-08-28 11:42 UTC Modified: 2002-09-21 02:07 UTC
From: daggillies at yahoo dot com Assigned:
Status: Closed Package: FrontBase related
PHP Version: 4.2.2 OS: Mandrake Linux/FreeBSD
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: daggillies at yahoo dot com
New email:
PHP Version: OS:


 [2002-08-28 11:42 UTC] daggillies at yahoo dot com

This function appears to be of critical importance. If
you are experiencing random hangs and crashes in your scripts, suspect a lack of fbsql_free_result().
It appears that failure to explicitly release a result set causes memory problems, usually manifested by Apache segfaulting. With FrontBase < 3.4, this caused us very serious problems as locks were not being released, resulting in a stalled database. With 3.4/3.5, this no longer happens, but nonetheless the httpd child dies, which means that pages are only partially output, and also impacts on performance. I don't know the internals of the fbsql PHP driver and don't have time to investigate further. I would suspect a bug in how cleanup in the garbage collector is implemented, possibly leading to attempts to free the same memory block twice, or an attempt to free a block with a bad pointer (although that would be more likely to yield a SIGBUS, at least occasionally, and we have only seen SIGSEGV). Simply using fbsql_free_result() without knowing exactly what is causing the problem might look like voodoo, but we have found it to be voodoo that works.

A typical FrontBase session might look like this:

$fbdc=fbsql_connect($DBServer,$DBUser,$DBPass) or die("Could not connect to db"); 
 echo "<P>DB select failed</P>\n";

$qstr="select * from products where qty_on_hand < 25;";


 echo "<P>Query [$qstr] failed: ".fbsql_errno().": ".fbsql_error()."</P>\n";


fbsql_free_result($oresult); <--- THIS IS CRITICAL


It is a big job to go back through a large set of scripts and retrofit this code. Although the manual states it should not be necessary, it would appear prudent to use this call in new code.

David Gillies
San Jose
Costa Rica


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-09-03 23:25 UTC]
Please try using this CVS snapshot:
For Windows:

Can you please try a snapshot dated sometime after today?  I've put in a fix which I believe will fix this.
 [2002-09-21 02:07 UTC]
No feedback, and should be fixed.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 25 04:01:28 2024 UTC