php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #22857 OCIExecute Hangs
Submitted: 2003-03-24 14:06 UTC Modified: 2003-03-31 02:24 UTC
From: dean at vipersoft dot co dot uk Assigned:
Status: Closed Package: OCI8 related
PHP Version: 4.3.1 OS: Linux 2.4
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: dean at vipersoft dot co dot uk
New email:
PHP Version: OS:

 

 [2003-03-24 14:06 UTC] dean at vipersoft dot co dot uk
Using the sample code below to submit a number of queries to an Oracle database - about every 1 in 10 executions causes the OCIExecute function to simple "hang" for about 10 minutes before timing out.

If more information is needed or any sorts of debugging is required, I will follow up to this bug with the requested information.

Thanks

Dean

#!/opt/php/bin/php -q
<?
  $webDbase = "blah";
  $webUser = "blah";
  $webPassword = "blah";

  global $ORACLE_HOME;
  $ORACLE_HOME = "/opt/oracle/OraHome81";
  PutEnv("ORACLE_SID=".$webDbase);
  PutEnv("LD_LIBRARY_PATH=$ORACLE_HOME/lib:/usr/lib:$ORACLE_HOME/jdbc/lib");
  PutEnv("ORACLE_HOME=".$ORACLE_HOME);

  $conn = ocilogon($webUser, $webPassword, $webDbase) or die ("Could not connect (Bad background connect Userid or Password) [".Getenv("ORACLE_SID")."]");

  // Loop around 4000 times - basically to throw a lot
  // of queries at the database
  for ($i=1;$i<=4000;$i++)
  {
    echo "Iteration ".$i."\n";

    // use a random number to use differing queries
    $strSQL = "SELECT *
                 FROM blah 
                WHERE id = '".rand(0,50000)."'";

    $qid = OCIparse($conn, $strSQL);

    echo "before execute\n";
    OCIexecute($qid);
    echo "after execute\n";
  }

  echo "Done";

?>

sample output from above when "hung"
.
.
.
Iteration 2671
before execute
after execute
Iteration 2672
before execute
after execute
Iteration 2673
before execute

<then nothing>

Notes:

* Doesn't happen every time
* Happens about 1 in every 10 runs of the above code
* Happens from both the CLI php and through Apache
* Eventually times out without finishing off its iteration


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-03-24 18:03 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-STABLE-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-STABLE-latest.zip

First of all, those putenv()'s are useless, you need to set
them in the environment before starting Apache / running CLI.

It might help if you tried debugging this with gdb.

# gdb /opt/php/bin/php
(gdb) run yourtest.php

And do that as many times as required to get it fail..

 [2003-03-31 02:00 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2003-03-31 02:04 UTC] dean at vipersoft dot co dot uk
Sorry for the lack of feedback - I was busy scratching my head! :)

The fix was a strange one.

I used to compile PHP with apache, then re-compile it for the CLI version.  To fix the problem, I just compiled PHP with apache, and did NOT build the CLI version.

Would that help explain why I have had *no* hangs since then?

Thanks

Dean
 [2003-03-31 02:14 UTC] sniper@php.net
No idea, but you don't need to compile CLI separately anyway. 
But it works, so..

 [2003-03-31 02:24 UTC] dean at vipersoft dot co dot uk
Ok - I am happy to mark this as closed, but if anyone else has the same/similar problem, maybe my comment on the CLI version (and not building it separately), might help.

Dean
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 04 21:01:32 2024 UTC