From:             levi_tedder at hotmail dot com
Operating system: Windows XP, Windows 2003
PHP version:      5.2.12
PHP Bug Type:     cURL related
Bug description:  Multiple curl_exec and curl_close looses host

Description:
------------
If you have a web server host that responds very quickly and you're doing
a lot of requests on it, curl will eventually respond "couldn't connect to
host". This happens on my Windows XP machine and Windows 2003 server, but
I've been unable to reproduce on Windows 2008. If I add a delay with
usleep(50000) it seems to be ok.
I'm not sure if this is by design, OS-restriction or wrong usage (I've
tried forums) or actual bug. Please forgive misplacement.

To get the script below to exit with "couldn't connect to host" you need a
fast responding web server host. 

Reproduce code:
---------------
<?php

$url = "http://www.example.com";;

for ($i = 1; $i <= 6000; $i++) {

    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    $result=curl_exec ($ch);

    if (curl_errno($ch)) {
        exit(curl_error($ch));
    } else {
        curl_close($ch);
        echo "count: $i\n";
    }
}
?> 

Expected result:
----------------
count: 1
.
.
count: 6000

Actual result:
--------------
count: 1
.
.
count 4322
couldn't connect to host

-- 
Edit bug report at http://bugs.php.net/?id=50553&edit=1
-- 
Try a snapshot (PHP 5.2):            
http://bugs.php.net/fix.php?id=50553&r=trysnapshot52
Try a snapshot (PHP 5.3):            
http://bugs.php.net/fix.php?id=50553&r=trysnapshot53
Try a snapshot (PHP 6.0):            
http://bugs.php.net/fix.php?id=50553&r=trysnapshot60
Fixed in SVN:                        
http://bugs.php.net/fix.php?id=50553&r=fixed
Fixed in SVN and need be documented: 
http://bugs.php.net/fix.php?id=50553&r=needdocs
Fixed in release:                    
http://bugs.php.net/fix.php?id=50553&r=alreadyfixed
Need backtrace:                      
http://bugs.php.net/fix.php?id=50553&r=needtrace
Need Reproduce Script:               
http://bugs.php.net/fix.php?id=50553&r=needscript
Try newer version:                   
http://bugs.php.net/fix.php?id=50553&r=oldversion
Not developer issue:                 
http://bugs.php.net/fix.php?id=50553&r=support
Expected behavior:                   
http://bugs.php.net/fix.php?id=50553&r=notwrong
Not enough info:                     
http://bugs.php.net/fix.php?id=50553&r=notenoughinfo
Submitted twice:                     
http://bugs.php.net/fix.php?id=50553&r=submittedtwice
register_globals:                    
http://bugs.php.net/fix.php?id=50553&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=50553&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=50553&r=dst
IIS Stability:                       
http://bugs.php.net/fix.php?id=50553&r=isapi
Install GNU Sed:                     
http://bugs.php.net/fix.php?id=50553&r=gnused
Floating point limitations:          
http://bugs.php.net/fix.php?id=50553&r=float
No Zend Extensions:                  
http://bugs.php.net/fix.php?id=50553&r=nozend
MySQL Configuration Error:           
http://bugs.php.net/fix.php?id=50553&r=mysqlcfg

Reply via email to