Flourish PHP Unframework
This is an archived copy of the forum for reference purposes

Server error on fRecordSet::build

posted by jonathanza 7 years ago

MySQL PHP 5.3 Flourish 1042

I seem to be hitting a 500 server error when attempting to build a recordset. The table is very simple and has no relations.

CREATE TABLE tx_ia_benchmark (
    uid int(11) NOT NULL auto_increment,
    pid int(11) DEFAULT '0' NOT NULL,
    crdate int(11) DEFAULT '0' NOT NULL,
    tstamp int(11) DEFAULT '0' NOT NULL,
    
    data_key varchar(50) not null,
    data_value varchar(255) not null,
    
    PRIMARY KEY (uid)
);

I created it just for testing. It contains just over 20 000 records. This command will fail:

$rsBenchmark = fRecordSet::build('Benchmark');

as well as this:

        $rsBenchmark = fRecordSet::build(
            'Benchmark',
            array(),
            array(),
            1500
        );

The schema is being cached in the database.

MySQL seems to be aborting the connection but the result set just seem so small.

I'd really appreciate it if anyone has some advice on where to look for a resolution to this issue.

Anything in the PHP error logs regarding memory? Have you tried running the query directly to MySQL to ensure it's not something wrong with MySQL? Also try the query using whichever extension Flourish is picking up (probably mysqli). Do all these succeed without issue?

It seems very unlikely that Flourish itself would be causing the problem, but it certainly could be something to do with the fact that Flourish abstracts it -- it necessarily will consume more memory than non ORM based queries.

posted by mattsah 7 years ago

Hi, thanks for the reply.

After some more testing I've found that this also fails:

$records = array();
$result = mysql_query("SELECT tx_ia_benchmark.* FROM tx_ia_benchmark") 
        or die(mysql_error());  
        
while($row = mysql_fetch_assoc( $result )) {
   $records[] = $row; //Server error thrown here
}

It seems that storing the results in the array results in an error if there are more than 8300 records.

No PHP errors and just this in web server log:

 (104)Connection reset by peer: mod_fcgid: error reading data from FastCGI server, referer: http://...

The database is on a remote server so I'm guessing that some setting/s on either the web server or database needs to changed.

It just seems odd that the error is thrown with such a relatively small set of records.

posted by jonathanza 7 years ago

It's not odd if the maximum memory limit you have is relatively small. Look at phpinfo() and see what your max memory usage is limited to.

posted by mattsah 7 years ago