#43098 [Opn]: file_get_contents() freezes (probably caused by fopen())

From: Date: Fri, 26 Oct 2007 10:49:03 +0000
Subject: #43098 [Opn]: file_get_contents() freezes (probably caused by fopen())
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-118978@lists.php.net to get a copy of this message
 ID:               43098
 User updated by:  harvie at email dot cz
 Reported By:      harvie at email dot cz
 Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: Linux (Debian Etch) - php5-cli
 PHP Version:      5.2.4
 New Comment:

Yeah! Thats what i need... Something like default_poll_timeout
setting...


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

[2007-10-26 10:40:18] harvie at email dot cz

jani@php.net: That is what i am saying, this will never comes to next
iteration. If i wan't to do some kind of error check, it will never be
executed, because whole program will stop at file_get_contents() and
will not execute anything after this call. Thats the problem. This
function will never return anything.

With this timeout, this script have to print '#' at least once a
second.

But the default_socket_timeout stops waiting for connection but in this
case the file_gets_contents() is already downloading when server drops
the connection because of network unstability or service overload.

Isn't there some kind of timeout, that will stop waiting for broken
connection after specified time?

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

[2007-10-26 08:16:58] jani@php.net

It won't matter what you put in timeout if you wrap everything in a
while(1) loop. Of course it just sits there, try adding some error
checking there..


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

[2007-10-25 17:21:10] harvie at email dot cz

2jani@php.net: It's possible, but in this case the
default_socket_timeout have to close the socket and continue with next
URL (crawler freezing too with many different URLs). Or
default_socket_timeout doesn't matter in here?

It's true, that my router sux, but i don't see any reason why PHP
should crash at first problem with connectivity, that ends in total
script freeze, i thought, that is why we have socket timeout option. Or
not?

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

[2007-10-25 11:57:20] jani@php.net

Are you sure it's not just your network connection freezing? f.e. some
kind of firewall stopping you from connecting to one site too many times
in too short time? (fyi: your script works fine for me, I stopped it
after 10 minutes..)


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

[2007-10-24 19:02:01] harvie at email dot cz

I tryed to run this at PHP4 - CLI (MS Windows Server2003)
It returned this errors. May be, this error is handled another way in
PHP5 and it causes the hang up...

c:/>bugshow.php
#0#1#2#3#4#5#6#7#8#9#10#11#12#13#14#15
Warning: file_get_contents(res:///PHP/http:\\w.moreover.com\):
failed
to open stream: No such file or directory in D:\bug.php on line 12
#16#17#18#19#20#21#22#23#24#25#26#27#28#29#30#31#32#33#34#35#36#37#38#39#40#41#4
2#43#44#45#46#47
Warning: file_get_contents(res:///PHP/http:\\w.moreover.com\):
failed
to open stream: No such file or directory in D:\bug.php on line 12
#48#49#50

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

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/43098

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


Thread (13 messages)

« previous php.bugs (#118978) next »