php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43455 cursor not closed after leaving function when selecting lobs
Submitted: 2007-11-29 16:54 UTC Modified: 2007-11-29 17:58 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:0 (0.0%)
From: michael dot virnstein at brodos dot de Assigned:
Status: Not a bug Package: OCI8 related
PHP Version: 5.2.5 OS:
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.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: michael dot virnstein at brodos dot de
New email:
PHP Version: OS:

 

 [2007-11-29 16:54 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-11-29 17:58 UTC] sixd@php.net
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
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue May 07 22:01:30 2024 UTC