ID:               40138
 User updated by:  rvadmin at mail dot ru
 Reported By:      rvadmin at mail dot ru
-Status:           Bogus
+Status:           Open
 Bug Type:         cURL related
 Operating System: Windows XP
 PHP Version:      5.2.0
 New Comment:

ok, but why php_curl.dll crashes on PHP <5.2.0???


Previous Comments:
------------------------------------------------------------------------

[2007-01-15 20:37:51] [EMAIL PROTECTED]

Windows crashes are not PHP problems, even if they are reproducible
only with PHP.

------------------------------------------------------------------------

[2007-01-15 20:14:31] rvadmin at mail dot ru

OOPS, not php.net but php.exe!
(sometimes php.exe, sometimes
php_curl.dll)

------------------------------------------------------------------------

[2007-01-15 20:13:13] rvadmin at mail dot ru

Description:
------------
I use curl_multi on php command line version at Windows XP.
After some time, php crashes (sometimes php.net, sometimes
php_curl.dll). If php after 1 hour working normal, after 2 hours
winsock crashes. My script is  web crawler that downloading web pages
and save them.
 I tried many builds of Windows XP, many versions of PHP5 and many
computers!!!.
On php 5.2.0 php not crashes, but windows crashes!!! (blue screen of
death:).
Usually I use 30 threads.

I need help, because I dont know how to resolve this problem! 
Please, sorry for my bad English!!!

Thank you.



Reproduce code:
---------------
<?
/*Only part of script*/
$urls=array("http://php.net"/*.... and other*/);
function read_header($ch, $string)
{
        $length = strlen($string);
        if(substr($string,0,13)=="Content-Type:" &&
!preg_match("#(text/html|text/plain)#",$string))
        return false; # if it is not HTML
        else
        return $length;
}
$mh = curl_multi_init();

foreach ($urls as $i => $url)
{

        $conn[$i]=curl_init();
        curl_setopt($conn[$i],CURLOPT_URL,$url);
        curl_setopt($conn[$i],CURLOPT_RETURNTRANSFER,1);//return data as
string
        curl_setopt($conn[$i],CURLOPT_CONNECTTIMEOUT,30);//timeout
        curl_setopt($conn[$i], CURLOPT_TIMEOUT, 120);
        curl_setopt($conn[$i], CURLOPT_MAXREDIRS, 1);
        curl_setopt($conn[$i], CURLOPT_NOSIGNAL, 1);
        curl_setopt($conn[$i], CURLOPT_NOPROGRESS, 1);
        curl_setopt($conn[$i], CURLOPT_FAILONERROR, 1);
        curl_setopt($conn[$i],CURLOPT_SSL_VERIFYPEER,0);
        curl_setopt($conn[$i],CURLOPT_SSL_VERIFYHOST,0);
        curl_setopt($conn[$i],CURLOPT_HEADERFUNCTION, 'read_header');
        curl_setopt($conn[$i],CURLOPT_FOLLOWLOCATION,1);
        curl_setopt($conn[$i],CURLOPT_USERAGENT,"Mozilla/4.0 (compatible; MSIE
6.0; Windows NT 5.1)");

        curl_multi_add_handle ($mh,$conn[$i]);

}

do { $mrc=curl_multi_exec($mh,$active); } while ($mrc ==
CURLM_CALL_MULTI_PERFORM);

while ($active and $mrc == CURLM_OK) {
  // wait for network
  if (curl_multi_select($mh) != -1) {
   // pull in any new data, or at least handle timeouts
   do {
     $mrc = curl_multi_exec($mh, $active);
   } while ($mrc == CURLM_CALL_MULTI_PERFORM);
  }
}
$ret=array();

foreach ($data as $i => $url)
{
         if (($err = curl_error($conn[$i])) == '')
         {
                 $c=curl_multi_getcontent($conn[$i]);
                 if($c!==false)
                 $ret[$i]=$c;
         }

        curl_multi_remove_handle($mh,$conn[$i]);
        curl_close($conn[$i]);
}
curl_multi_close($mh); 
/*...*/
?>

Expected result:
----------------
Curl and php/cli must work normal without high CPU loading when working
long time and without winsock and php crashes.

Actual result:
--------------
Php crashes or (if php works long time) winsock crashes or windows XP
(at PHP 5.2.0 ) blue screen crash


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=40138&edit=1

Reply via email to