#49560 [Opn->Fbk]: OCI_RETURN_LOBS causes php_shutdown to take very long
| From: | sixd@php.net | Date: | Tue, 15 Sep 2009 15:17:37 +0000 |
| Subject: | #49560 [Opn->Fbk]: OCI_RETURN_LOBS causes php_shutdown to take very long | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-142373@lists.php.net to get a copy of this message | ||
ID: 49560
Updated by: sixd@php.net
Reported By: j dot henge-ernst at interexa dot de
-Status: Open
+Status: Feedback
Bug Type: OCI8 related
Operating System: linux
PHP Version: 5.2.10
Assigned To: sixd
Previous Comments:
------------------------------------------------------------------------
[2009-09-15 15:17:04] sixd@php.net
What version Oracle client and database?
By shutdown do you mean end-of-web-request, or shutdown of the PHP
process?
It might be a symptom of a LOB ref count issue we've recently
uncovered, or it might just be Oracle having to clean up.
------------------------------------------------------------------------
[2009-09-15 12:20:06] j dot henge-ernst at interexa dot de
Description:
------------
If you read a lot of clobs/blob via oci_fetch_array($stmt,
OCI_RETURN_NULLS+OCI_ASSOC+OCI_RETURN_LOBS) it causes php_shutdown to
take a very long time.
Depending on the rows you read via oci_fetch_array the php_shutdown
takes longer and longer. Examples:
10.000 rows read with one lob column 0.1 seconds
20.000 rows read with one lob column 2 seconds
30.000 rows read with one lob column 8 seconds
40.000 rows read with one lob column 28 seconds
50.000 rows read with one lob column 60 seconds
100.000 rows read with one lob column 1800 seconds
This also happens if you skip the OCI_RETURN_LOBS and you don't use
->free on the returned lob-object.
Tested with oci8 extension form php 5.2.10 and php 5.3.0
Reproduce code:
---------------
$conn = oci_connect($user, $user, $db);
$tcst = oci_parse($conn, 'CREATE TABLE TESTTABLE ( PK NUMBER NOT NULL,
TB BLOB , CONSTRAINT TABLE1_PK PRIMARY KEY ( PK) ENABLE)');
oci_execute($tcst);
oci_free_statement($tcst);
for ($i = 1; $i <= 10000; ++$i) {
$stmt = oci_parse($conn, "insert into testtable (PK, TB)
values(:PK, :TB)");
oci_bind_by_name($stmt, ':PK', $i, -1);
$lob = oci_new_descriptor($conn, OCI_DTYPE_LOB);
oci_bind_by_name($stmt, ':TB', $lob, -1, OCI_B_BLOB);
$lob->writeTemporary('aaaaaaaaaaaaaaaaaaaa', OCI_TEMP_BLOB);
oci_execute($stmt, OCI_DEFAULT);
$lob->close();
$lob->free();
oci_free_statement($stmt);
}
oci_commit($conn);
for ($i = 0; $i <= 10; ++$i) {
$stmt = oci_parse($conn, 'Select PK, TB FROM TESTTABLE');
oci_execute($stmt, OCI_DEFAULT);
OCISetPrefetch($stmt, 100);
while (($row = oci_fetch_array($stmt,
OCI_RETURN_NULLS+OCI_ASSOC+OCI_RETURN_LOBS )) !== false);
oci_free_statement($stmt);
}
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=49560&edit=1