#47773 [Fbk->Opn]: cURL multi crashes
ID: 47773 User updated by: entpman at gmail dot com Reported By: entpman at gmail dot com -Status: Feedback +Status: Open Bug Type: cURL related Operating System: WIN XP SP2 PHP Version: 5.2.9 Assigned To: pajoye New Comment: I tried version 5.3.0RC2-dev same results. Previous Comments: [2009-03-25 14:11:53] paj...@php.net Please try using this CVS snapshot: http://snaps.php.net/php5.3-latest.tar.gz For Windows: http://windows.php.net/snapshots/ [2009-03-25 14:08:06] entpman at gmail dot com Description: The program will work fine for hundreds of downloads then suddenly crashes. Reproduce code: --- 'http://www.google.com' ), array( 'url' => 'http://www.yahoo.com' ) ) ); // of course more urls are needs function downloadurls($downloads,$cookie = null){ $timeout = 30; $mcurl = curl_multi_init(); $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/2009201 Firefox/3.0.0.1"; foreach($downloads as $key=>$download){ $url = $download['url']; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0); curl_setopt($ch, CURLOPT_USERAGENT, $agent); if(!empty($download['postdata'])){ curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$download['postdata']); } if(!empty($cookie)){ @unlink($cookie); //echo "added cookie\n"; curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); } if(!empty($download['proxy'])){ curl_setopt($ch, CURLOPT_PROXY, $download['proxy']); } curl_multi_add_handle($mcurl, $ch); $downloads[$key]['handle'] = $ch; } do { $n=curl_multi_exec($mcurl,$active); usleep(100); } while ($active); foreach($downloads as $key=>$download){ $ch = $download['handle']; $done_content = curl_multi_getcontent($ch); if(curl_errno($ch) == 0) { $downloads[$key]['picture'] = $done_content; } else { exit('error'); } curl_multi_remove_handle($mcurl, $ch); curl_close($ch); } curl_multi_close($mcurl); return $downloads; } ?> Actual result: -- backtrace: php_curl.dll!_Curl_llist_insert_next() + 0x48 bytes php_curl.dll!_Curl_hash_add() + 0x74 bytes php_curl.dll!_Curl_cache_addr() + 0x6d bytes php_curl.dll!_Curl_addrinfo4_callback() + 0x82 bytes php_curl.dll!_Curl_addrinfo4_callback() + 0x14 bytes php_curl.dll!_Curl_getaddrinfo() + 0x317 bytes msvcrt.dll!77c3a3b0() [Frames below may be incorrect and/or missing, no symbols loaded for msvcrt.dll] kernel32.dll!7c80b683() -- Edit this bug report at http://bugs.php.net/?id=47773&edit=1
#47773 [NEW]: cURL multi crashes
From: entpman at gmail dot com Operating system: WIN XP SP2 PHP version: 5.2.9 PHP Bug Type: cURL related Bug description: cURL multi crashes Description: The program will work fine for hundreds of downloads then suddenly crashes. Reproduce code: --- 'http://www.google.com' ), array( 'url' => 'http://www.yahoo.com' ) ) ); // of course more urls are needs function downloadurls($downloads,$cookie = null){ $timeout = 30; $mcurl = curl_multi_init(); $agent = "Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.12) Gecko/2009201 Firefox/3.0.0.1"; foreach($downloads as $key=>$download){ $url = $download['url']; $ch = curl_init(); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_TIMEOUT, $timeout); curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 15); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,0); curl_setopt($ch, CURLOPT_USERAGENT, $agent); if(!empty($download['postdata'])){ curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$download['postdata']); } if(!empty($cookie)){ @unlink($cookie); //echo "added cookie\n"; curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie); curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie); } if(!empty($download['proxy'])){ curl_setopt($ch, CURLOPT_PROXY, $download['proxy']); } curl_multi_add_handle($mcurl, $ch); $downloads[$key]['handle'] = $ch; } do { $n=curl_multi_exec($mcurl,$active); usleep(100); } while ($active); foreach($downloads as $key=>$download){ $ch = $download['handle']; $done_content = curl_multi_getcontent($ch); if(curl_errno($ch) == 0) { $downloads[$key]['picture'] = $done_content; } else { exit('error'); } curl_multi_remove_handle($mcurl, $ch); curl_close($ch); } curl_multi_close($mcurl); return $downloads; } ?> Actual result: -- backtrace: php_curl.dll!_Curl_llist_insert_next() + 0x48 bytes php_curl.dll!_Curl_hash_add() + 0x74 bytes php_curl.dll!_Curl_cache_addr() + 0x6d bytes php_curl.dll!_Curl_addrinfo4_callback() + 0x82 bytes php_curl.dll!_Curl_addrinfo4_callback() + 0x14 bytes php_curl.dll!_Curl_getaddrinfo() + 0x317 bytes msvcrt.dll!77c3a3b0() [Frames below may be incorrect and/or missing, no symbols loaded for msvcrt.dll] kernel32.dll!7c80b683() -- Edit bug report at http://bugs.php.net/?id=47773&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=47773&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=47773&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=47773&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=47773&r=fixedcvs Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47773&r=needdocs Fixed in release: http://bugs.php.net/fix.php?id=47773&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=47773&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=47773&r=needscript Try newer version: http://bugs.php.net/fix.php?id=47773&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=47773&r=support Expected behavior: http://bugs.php.net/fix.php?id=47773&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=47773&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=47773&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=47773&r=globals PHP 4 support discontinued: http://bug