php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #28924 Apache SAPI and Oracle OCI memory conflict
Submitted: 2004-06-25 16:56 UTC Modified: 2005-01-18 17:34 UTC
Votes:13
Avg. Score:4.8 ± 0.4
Reproduced:12 of 12 (100.0%)
Same Version:8 (66.7%)
Same OS:8 (66.7%)
From: ben at grinvalds dot net Assigned: tony2001 (profile)
Status: Closed Package: OCI8 related
PHP Version: 5.0.0RC3 OS: Windows XP
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: ben at grinvalds dot net
New email:
PHP Version: OS:

 

 [2004-06-25 16:56 UTC] ben at grinvalds dot net
Description:
------------
I have been testing my code in PHP5 and have been getting regular Apache.exe Application errors.

When I run the script below a few times, I will consistantly get reference memory errors.  Even after I re-boot my system.  My application makes many calls to an Oracle database.  I'm not sure if this is specifically related to OCI or if it is a more general PHP memory issue.

Environment:
  OS: Windows XP Professional with SP1
  Server: Apache 1.3.31 (Win32)
  DB: Oracle 8.4.7  

Reproduce code:
---------------
<?php
  $conn = oci_connect("scott", "tiger", "your_host_name");
  for ($p=0; $p <= 500; $p++) {
    $stmt = oci_parse($conn, "select ENAME from emp");
    oci_execute($stmt);
    $i = 0;
    while (oci_fetch($stmt)) {
      $i++;
      $name = oci_result($stmt, "ENAME");
      echo $name . "<br>";
    }
    echo "<br>";
    echo $i . " Records Selected. Count:" . $p;
    echo "<br><br>";
  }
  oci_free_statement($stmt);
  oci_close($conn);
?> 

Expected result:
----------------
I should be able to run this without encountering any Apache.exe Application error.

Actual result:
--------------
The error message that I am receiving is: The instruction at "0x6042fdc2" refereced memory at "0x00000010". The memory could not be "read".


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-06-29 16:11 UTC] ben at grinvalds dot net
I have included a script which causes a reference memory error to occur more frequently.  If you run this script three or four times back to back you will get the error.

Ben

<?php
class Test {
  var $_results;
  var $_ncount;
  function display() {
    $conn = oci_connect("scott", "tiger", "host_name");
    $stmt = oci_parse($conn, "select ENAME from emp");
    oci_execute($stmt);
    $this->_ncount = oci_fetch_all($stmt, $this->_results);
    oci_free_statement($stmt);
    oci_close($conn);
    for ($i = 0; $i < $this->_ncount; $i++) {
	echo $this->_results["ENAME"][$i];
  }}}
$test = new Test();
$test->display();
?>
 [2004-06-30 18:15 UTC] ben at grinvalds dot net
I've been doing some more investigation.  When I changed my php configuration in the Apache http.conf from sapi to cgi, the problem goes away.  Looks like the problem is related to the sapi module.
 [2004-07-19 17:24 UTC] tony2001@php.net
Could you please try latest CVS snapshots from http://snaps.php.net?
And could you try to run the code from console too? 
Does it crash?
 [2004-07-19 23:46 UTC] ben at grinvalds dot net
I went and got the latest version PHP 5.0.1-dev (cli).  I ran the following script from the console and it consistantly hung the php execution.  This is how I executed it at the command prompt (> php.exe -f test.php).
Here is the script I ran.  The object count for my database was just over 10,000 records.

<?php 
    $conn = oci_connect("scott", "tiger", "yourhost");
    $stmt = oci_parse($conn, "select * from all_objects where owner = 'SYS'");
    oci_execute($stmt);
    $count = 0;
    while ($row = oci_fetch_assoc($stmt))
	echo $count++ . " ";
    oci_free_statement($stmt);
    oci_close($conn);
    echo "Executed Query";
?>
 [2004-08-23 12:49 UTC] tanis at altralogica dot it
I am experiencing the same problem with Apache 1.3.29 and PHP 5.0.0, 5.0.1 and 5.0.2-dev of today (August, 23), so I guess this has not been solved yet.

Is there anything I could to do help debug this problem? I am getting mad trying to work with this configuration but I cannot do otherwise. 
Till now 5.0.0 is the only one that is working from time to time. All other versions hung immediately.
 [2004-08-25 14:42 UTC] wreckmybike at yahoo dot com
Here?s the setup: windows XP/Apache2.0.50/PHP5.0.0(SAPI)/Oracle 9.2 

Applications interacting with OCI8 (logon, parse, execute, fetch,logoff), which worked as expected using the latest PHP4 release, resulted in an apache2 crash. "Parent: child process exited with status 3221225477 -- Restarting"..

I then upgraded to PHP5.0.1 which seems to have fixed the above crashes but now causes every couple of requests to result in the browser hanging - waiting for the server response. If I hit the browsers refresh button it forces a response. I suspect it has something to do with the OCI8 Logon/Logoff function.  

I have none of these issues when running PHP5 as a CGI.
 [2004-09-23 13:56 UTC] andrew at onvol dot net
I have to same problem and I've tried with the following setups:

windows 2K/Apache2.0.50/PHP5.0.1(SAPI)/Oracle 9.2 
windows 2K/Apache1.3.31/PHP5.0.1(SAPI)/Oracle 9.2 

Seems to work fine with CGI.
 [2004-09-30 23:33 UTC] cdcampos at netcabo dot pt
I have an application running on PHP5, using OCI8, and the only scenario in which I was able have some stability is with 5.0.0 (like Tanis reported above). Even so, it hangs every now and then, and Apache needs to be restarted.

I looked at the change log in 5.0.2 and found nothing about this (serious) problems with the extension. I have upgraded my application to version 5, mostly because of the SOAP functions, but it seems that the OCI8 extension was not ready yet...
 [2004-10-01 11:42 UTC] marcin at mikronika dot pl
I had the same problem but I think I resolve it:
- remove all "putenv" function from your code!
- replace function names : "ocilogon","oci_connect", "oci_pconnect" etc. on: "oci_new_connect"!
No more apache crashes. Tested on 2 machines with
win 2000 php 5.0.1 / 5.0.2.
 [2004-10-26 13:50 UTC] lisandrofalcon at hotmail dot com
using php 5.0.3 + apache-1.3.31 + win2000.
the problem fixed changing conection functions ocilogon/ocilogoff by oci_new_connect /oci_close. in the php manual you can read this functions are deprecated for php5 >=.
 [2004-11-02 12:12 UTC] dima at ss2 dot dimych dot sumy dot ua
I have same problem but with IIS SAPI.
Changing OCIPLogon/OCILogoff to OCI_NEW_CONNECT/OCI_CLOSE help to fix problem. Thanks.
 [2004-11-09 23:15 UTC] jim5359 at yahoo dot com
I'm having the same problem using Oracle 10g client.  I'm wondering if this has something to do with it?

http://forums.oracle.com/forums/thread.jsp?forum=147&thread=256672&message=761893&q=6372617368#761893
 [2005-01-18 17:34 UTC] ben at grinvalds dot net
Re-tested all scripts with latest version and I am not having any more memory errors.

Thanks,
  Ben
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Mon Aug 15 01:05:44 2022 UTC