php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57193 HttpRequestPool suppresses exceptions
Submitted: 2006-08-22 11:01 UTC Modified: 2007-02-20 04:42 UTC
From: edoardo dot serra at webrainstorm dot it Assigned: mike (profile)
Status: Closed Package: pecl_http (PECL)
PHP Version: 5.1.4 OS: Linux 2.6.11-1.1369_FC4smp
Private report: No CVE-ID: None
 [2006-08-22 11:01 UTC] edoardo dot serra at webrainstorm dot it
Description:
------------
Hi guys,
I'm using pecl_http 1.2.0 with curl enbabled (v7.13.1) and libz enabled (v1.2.2.2)

I'm testing HttpRequestPool with different numbers of requests.

When I use it to do 1000 or more requests it executes only a small amount of requests without giving exceptions of any kind.

That small amount of request is varying from time to time.
With the code below (1000 expected requests) I got a number of executed requests varying from 200 to 300.
(I got the number of executed requests grepping in the webserver logfile double checking with the script output)

I'm executing the script from the CLI

Reproduce code:
---------------
#!/usr/local/bin/php -q

<?php
set_time_limit(0);

/* utilize onfinish callback */
class Request extends HttpRequest {
    function onFinish($success) {
        printf("- %s -> %3d \n", $this->getUrl(), $this->getResponseCode());
    }
}

$o = array("connecttimeout" => 10, "redirect" => 10);

for ($i = 1; $i <= 1000; $i++)
        $u[] = "http://test.webrainstorm.it/httpool/index.php?run1000A=".$i;

foreach ($u as $url) {
    $r[] = new Request($url, HTTP_METH_GET, $o);
}

printf ("Should do %d requests\n", count($r));

/* run requests in a pool */
$p = new HttpRequestPool;
foreach ($r as $request) {
    $p->attach($request);
}

try {
    $p->send();
} catch (HttpRequestPoolException $ex) {
    foreach ($ex->exceptionStack as $e) {
        echo $e, "\n";
    }
}
?>


Expected result:
----------------
1000 lines indicating executed requests

Actual result:
--------------
200-300 lines indicating executed requests

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-23 09:44 UTC] mike@php.net
I'd appreciate if you could try current CVS version.

The exception was suppressed and it should be fixed in CVS.
You were hitting the timeout.  Please note that there's no exceptionStack property anymore, use something like the following instead:

do {
  echo $ex, "\n";
while ($ex = @$ex->innerException);

Thanks.
 [2006-08-24 07:42 UTC] mike@php.net
This bug has been fixed in CVS.

In case this was a documentation problem, the fix will show up at the
end of next Sunday (CET) on pecl.php.net.

In case this was a pecl.php.net website problem, the change will show
up on the website in short time.
 
Thank you for the report, and for helping us make PECL better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Nov 03 23:01:27 2024 UTC