From:             harvie at email dot cz
Operating system: Linux (Debian Etch) - php5-cli
PHP version:      5.2.4
PHP Bug Type:     Reproducible crash
Bug description:  file_get_contents() freezes (probably caused by fopen())

Description:
------------
I have writed spider/crawler to make some web search engine as school
project.

So... I have small problem:
I am using file_get_contents() (i've tryed fopen() too...).
Crawler works 100% great, but sometimes it freezing. I have tryed to trace
what function freezes, and i found it, it's file_get_contents()...

So, i googled and found default_socket_timeout setting, i set it to 1, but
sometimes its freezes and never get up again.

I've done this example, so you can see, that it freezes after few
iterations. I have supplyed URL, that causes freeze of my crawler (im not
sure why...):


Reproduce code:
---------------
#!/usr/bin/php
< ?php

/*Run and wait for a while, this can totaly stop the script at the dead
point...*/

ini_set('default_socket_timeout',1);
set_time_limit(0);
//$url='http://ad.doubleclick.net/click';
$url='http://w.moreover.com/';
while(1) {
    @file_get_contents($url, false, null, 0, 10000);
    echo "#";
}

?>

Expected result:
----------------
I will download file from specified URL few times, and after that it will
freeze and never be better...
(It works if you are using different url each time too, but it takes more
time...)


Actual result:
--------------
harvie-ntb:/home/harvie/Desktop/crawler# ./bugshow.php
#1#2#3#4#5#6#7#8#9#10#11#12#13#14#15#16#17

And in there it freezes for eternity (i thought, that this will continue
after 1 second if failed with ini_set('default_socket_timeout',1);, But
whole script stops, i tryed to wait realy long long time...)


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

Reply via email to