Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9093 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51300 invoked by uid 1010); 12 Apr 2004 22:29:29 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 51271 invoked from network); 12 Apr 2004 22:29:29 -0000 Received: from unknown (HELO tomts20-srv.bellnexxia.net) (209.226.175.74) by pb1.pair.com with SMTP; 12 Apr 2004 22:29:29 -0000 Received: from caedmon.net ([65.94.84.53]) by tomts20-srv.bellnexxia.net (InterMail vM.5.01.06.05 201-253-122-130-105-20030824) with ESMTP id <20040412222929.VFNJ15811.tomts20-srv.bellnexxia.net@caedmon.net> for ; Mon, 12 Apr 2004 18:29:29 -0400 Message-ID: <407B1849.6080705@caedmon.net> Date: Mon, 12 Apr 2004 18:29:29 -0400 User-Agent: Mozilla Thunderbird 0.5 (X11/20040306) X-Accept-Language: en-us, en MIME-Version: 1.0 To: internals@lists.php.net Content-Type: multipart/mixed; boundary="------------050109070708060109010806" Subject: Possible resource leak? From: sean@caedmon.net (Sean Coates) --------------050109070708060109010806 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit 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 --------------050109070708060109010806--