Topic: Oracle queries using oci_fetch_all causes Core Dumps
THIS ALSO REPORTED AT
https://bugs.php.net/bug.php?id=71708
Description:
------------
Oracle queries using oci_fetch_all causes Core Dumps sometimes if more than one record result set.
My setup: oracle-instantclient12.1-basic, OCI8 2.1.0, PHP 70, php70-php-cli (7.0.4-1.el6.remi - 2016-03-02), Red Hat EL 6.7, HTTPD 24
Observations on oci_fetch_all queries:
1. If the query return set contains only one record, no problems.
2. For more than one records return: Sometimes causes core dump (browser Error 500 Internal server error).
a. If total return bytes is large, core dump probability increases (possible cap on rows * bytes per record per clumn cell)
b. Or sometimes error on only 2+ records - yet removing various columns reduces error probability.
c. Queries with "joins" increase error probability.
Test script:
---------------
// Cor dumps on many random queries - see Observations above
$statement= oci_parse($connID, $query);
oci_execute($statement)
// ================= BAD, CORE DUMP:
$numRows = oci_fetch_all($statement, $results);
Expected result:
----------------
yum php70-php-cli (remi) was updated last night, but still no work.
POSSIBLE WORKAROUND:
// *********** (THIS DOES NOT WORK RIGHT NOW!!!!) **********
$allCols = oci_num_fields($st);
$colNames = array();
for ($i_c = 1; $i_c <= $allCols; $i_c++) {
$aColName = oci_field_name($statement, $i_c);
$colNames[] = $aColName;
}
$numRows = 0;
while (($row = oci_fetch_array($statement, OCI_BOTH)) != false) {
$numRows++;
foreach ($colNames as $i_c=>$aColName)
$results[$aColName][] = $row[$aColName];
}
Actual result:
--------------
//~~~~~~~~~~~~~~~~~~~ CORE DUMP
#> tail /var/log/messages
Mar 2 22:17:17 node6 abrtd: Directory 'ccpp-2016-03-02-22:17:17-32306' creation detected
Mar 2 22:17:17 node6 abrt[32307]: Saved core dump of pid 32306 (/opt/remi/php70/root/usr/bin/php-cgi) to /var/spool/abrt/ccpp-2016-03-02-22:17:17-32306 (11370496 bytes)
Mar 2 22:17:17 node6 abrtd: Package 'php70-php-cli' isn't signed with proper key
Mar 2 22:17:17 node6 abrtd: 'post-create' on '/var/spool/abrt/ccpp-2016-03-02-22:17:17-32306' exited with 1
Mar 2 22:17:17 node6 abrtd: Deleting problem directory '/var/spool/abrt/ccpp-2016-03-02-22:17:17-32306'