php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37605 PDO stored procedure prepare call hangs
Submitted: 2006-05-26 17:09 UTC Modified: 2006-08-02 01:00 UTC
Votes:7
Avg. Score:4.7 ± 0.7
Reproduced:7 of 7 (100.0%)
Same Version:6 (85.7%)
Same OS:2 (28.6%)
From: randall dot carlson at navy dot mil Assigned:
Status: No Feedback Package: PDO related
PHP Version: 5.1.4 OS: REL 4
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2006-05-26 17:09 UTC] randall dot carlson at navy dot mil
Description:
------------
It appears the PDO execute is hanging when a MySQL stored procedure is called. The same code works fine on PHP 5.1.2 & MySQL 4.0.21.  Once we upgraded to 5.1.4, the problem began.  It looks as if the call is being executed a couple of times in the MySQL queries.log.  Our application code has many such calls and after attempting to execute each one the browser eventually timesout.

When I subtitute the SQL statment in the prepare, it comes back fine.

Reproduce code:
---------------
create procedure pdo_test() begin select dummy from dummy; end;


$pdo = new PDO("mysql:host=localhost;dbname=x","x","x");
$stmt = $pdo->prepare("call pdo_test()"/*"select dummy from dummy;"*/);
$stmt->execute();
echo "<B>outputting...</B><BR>";
while ($rs = $stmt->fetch(PDO::FETCH_OBJ)) {
	echo "output: ".$rs->dummy."<BR>";
}
echo "<BR><B>".date("r")."</B>";

Expected result:
----------------
should get 

outputting...
output: 1

Fri, 26 May 2006 13:02:17 -0400


Actual result:
--------------
timeout

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-05-29 11:10 UTC] tony2001@php.net
Works perfectly fine here.
But doesn't output any results, of course, since there is no "dummy" table with "dummy" field.
 [2006-05-30 11:36 UTC] randall dot carlson at navy dot mil
My code is within a portal application so, your test is slightly different than mine.  Again, as of PHP 5.1.2, the portal application and my code works just fine.  It was only when PHP 5.1.4 was built that this issue appeared.  Now as I monitor the mysql logs, I have discovered that when it hangs, the stored procedure calls appear to be executing twice (while one call was issued).
 [2006-05-30 11:42 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.


 [2006-06-05 20:50 UTC] randall dot carlson at navy dot mil
Well, my problem involves database access with PDO, so I don't know how to convey the problem without a database.  As far as the script itself:

<?php
$pdo = new PDO("mysql:host=localhost;dbname=x","x","x");
$stmt = $pdo->prepare("call pdo_test()"/*"select dummy from dummy;"*/);
$stmt->execute();
echo "<B>outputting...</B><BR>";
while ($rs = $stmt->fetch(PDO::FETCH_OBJ)) {
	echo "output: ".$rs->dummy."<BR>";
}
echo "<BR><B>".date("r")."</B>";
?>

That is all of it, except for the MySQL stored procedure script:
create procedure pdo_test() begin select dummy from dummy; end;
 [2006-06-20 14:44 UTC] tony2001@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php5.2-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5.2-win32-latest.zip

Still can't reproduce.
 [2006-06-28 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2006-07-24 21:33 UTC] laurinkus at gmail dot com
Facing same problem with 5.1.4 on FreeBSD 5.1 and MySQL 5.1.11. Code extract below:

function getOMXDailySnapshot($submarkets_id)
{
	$db = Zend::registry('db');
	
	$stm = $db->prepare('CALL omx_daily_snapshot(:submarket_id)');
	$stm->bindValue('submarket_id',$submarkets_id);
	
	$stm->execute();
	
	$result = $stm->fetchAll();
	
	return $result;
}

It seems to me that it is somehow related to result set   length.
 [2006-07-25 13:37 UTC] randall dot carlson at navy dot mil
I've been contacted by another user with the same issue.  Please review with laurinkus at gmail dot com.
 [2006-07-25 13:39 UTC] tony2001@php.net
We still need a reproduce script.
 [2006-07-25 15:02 UTC] laurinkus at gmail dot com
Please look at:
http://spekuliantai.no-ip.org/la/php_problems/

I've managed to reproduce problem using these files.
 [2006-07-25 15:18 UTC] tony2001@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.


 [2006-07-25 15:42 UTC] laurinkus at gmail dot com
In this case PHP doesn't crash. It's only hanging when a MySQL stored procedure is called.

Please look at URL provided above again, I've added CLI version of same script.
 [2006-08-02 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Apr 29 19:01:30 2024 UTC