Hello,
I don't believe this to be a php-general question, and seems more like a
bug, but I'm soliciting opinions before posting it as such. It DOES
seem like an internals problem, but I could be wrong, and if I am,
please explain why.
See the attached code; it has been isolated from PEAR (core) and
PEAR::Net_Socket.
Basically, after a certain number of iterations (Linux, PHP4.3.4 and
4.3.6RC3, maybe others), PHP runs out of file resources.
Warning: fsockopen()
: unable to connect to 192.168.100.51:80 in
/home/sean/www/dev3/crashing_resources.php on line 51
ERROR: 24 - Too many open files
This SEEMS to be a leak (file handles are never closed?) in
method_exists, get_classname or get_parent_classname, because if I
remove the ShrunkenPEAR constructor (OR, the _ShrunkenPEAR method), the
code does not fail.
Additionally, if I instanciate ShrunkenSocket as $sock = new
ShrunkenSocket() (value instead of reference), the error is also absent.
The reason I'm using a reference: PEAR::HTTP_Request instanciates
Net_Socket as such.
Also, as mentioned in a comment in the code, if I change the die to an
echo, the script segfaults after ~65535 iterations (which seems like an
overflow problem).
Any insight? I'm happy to post this as a bug (or move this to the PEAR
list) if it is such.
S
We can't see your attachment; the list server filters it out. Would you
put it on a web site?
Thanks,
Ken
My apologies.
http://sean.caedmon.net/php/crashing_resources.phps
S
Ken Tossell wrote:
We can't see your attachment; the list server filters it out. Would you
put it on a web site?Thanks,
Ken