#43455 [Opn->Bgs]: cursor not closed after leaving function when selecting lobs
| From: | sixd@php.net | Date: | Thu, 29 Nov 2007 17:58:57 +0000 |
| Subject: | #43455 [Opn->Bgs]: cursor not closed after leaving function when selecting lobs | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-120226@lists.php.net to get a copy of this message | ||
ID: 43455
Updated by: sixd@php.net
Reported By: michael dot virnstein at brodos dot de
-Status: Open
+Status: Bogus
Bug Type: OCI8 related
PHP Version: 5.2.5
New Comment:
Please do not submit the same bug more than once. An existing
bug report already describes this very problem. Even if you feel
that your issue is somewhat different, the resolution is likely
to be the same.
Thank you for your interest in PHP.
Appears to be a duplicate of http://bugs.php.net/bug.php?id=42496
Previous Comments:
------------------------------------------------------------------------
[2007-11-29 16:54:11] michael dot virnstein at brodos dot de
Description:
------------
PHP 5.2.3 / 5.2.4 / 5.2.5
Apache 2.2.6
Oracle-DB 10.2.0.3.0
Oracle-Client 10.2.0.3
OS Linux
Usually, when leaving a function, php closes e.g. statements
implicitly. This works as long as a lob is selected. When a lob is
selected, i have to call oci_free_statement() explicitly on the
statement, otherwise the cursor is kept open and i have a dangling
cursor. This issue can cause an "ORA-01000: maximum open cursors
exceeded".
Our db setting for open_cursors is 300, so every session is allowed to
have max 300 cursors open simultaneously. if i run the reproduce code
below, i get an ORA-01000
create the following table:
create table t_lobdata
(
id number not null,
data clob
);
fill table:
insert into t_lobdata
select rownum, object_name
from sys.all_objects;
Reproduce code:
---------------
<?php
$conn = ocilogon('user', 'pass', 'db');
function getLob($conn, $id)
{
$result = null;
$stmt = ociparse($conn, 'select id, data
from t_lobdata
where id = :id');
ocibindbyname($stmt, ':id', $id, -1);
ociexecute($stmt, OCI_DEFAULT);
ocifetchinto($stmt, $result, OCI_ASSOC+OCI_RETURN_LOBS);
return $result;
}
for ($id = 1; $id <= 300; $id++) {
$result = getLob($conn, $id);
}
?>
Expected result:
----------------
cursor gets closed implicitly when leaving the function
Actual result:
--------------
cursor isn't closed, which results in dangling cursors and an ORA-01000
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=43455&edit=1