|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40138 curl_multi, PHP/CLI crash, abnormally CPU load and Blue screen
Submitted: 2007-01-15 20:13 UTC Modified: 2007-01-16 08:29 UTC
Avg. Score:5.0 ± 0.0
Reproduced:0 of 0 (0.0%)
From: rvadmin at mail dot ru Assigned:
Status: Not a bug Package: cURL related
PHP Version: 5.2.0 OS: Windows XP
Private report: No CVE-ID: None
 [2007-01-15 20:13 UTC] rvadmin at mail dot ru
I use curl_multi on php command line version at Windows XP.
After some time, php crashes (sometimes, 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(""/*.... 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
	return $length;
$mh = curl_multi_init();

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

	curl_setopt($conn[$i],CURLOPT_RETURNTRANSFER,1);//return data as string
	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_HEADERFUNCTION, 'read_header');
	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);

foreach ($data as $i => $url)
         if (($err = curl_error($conn[$i])) == '')


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


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-01-15 20:14 UTC] rvadmin at mail dot ru
OOPS, not but php.exe!
(sometimes php.exe, sometimes
 [2007-01-15 20:37 UTC]
Windows crashes are not PHP problems, even if they are reproducible only with PHP.
 [2007-01-16 08:18 UTC] rvadmin at mail dot ru
ok, but why php_curl.dll crashes on PHP <5.2.0???
 [2007-01-16 08:29 UTC]
Update PHP to the latest version.
I don't think we can go to the past and re-fix something that has been already fixed in 5.2.0.
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Feb 26 19:01:24 2021 UTC