Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13810 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11318 invoked by uid 1010); 10 Nov 2004 16:07:23 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 11271 invoked from network); 10 Nov 2004 16:07:22 -0000 Received: from unknown (HELO smtp.unet.ru) (213.219.244.56) by pb1.pair.com with SMTP; 10 Nov 2004 16:07:22 -0000 Received: from host.phpclub.net by smtp.unet.ru (8.12.9/Unet) with ESMTP id iAAG7A9c063631; Wed, 10 Nov 2004 19:07:10 +0300 (MSK) Received: from s17.hibet.ru by host.phpclub.net (8.12.6/Unet) with ESMTP id iAAG79LV034984; Wed, 10 Nov 2004 19:07:10 +0300 (MSK) Date: Wed, 10 Nov 2004 19:08:18 +0300 To: "ilya77@gmail.com" Cc: internals@lists.php.net, wez@php.net Message-ID: <20041110190818.5964bc98.tony2001@phpclub.net> In-Reply-To: References: X-Mailer: Sylpheed version 0.9.99 (GTK+ 1.2.10; i686-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [PATCH] Bug #30743 - proc_close() causes a handle leak From: tony2001@phpclub.net (Antony Dovgal) On Wed, 10 Nov 2004 17:49:45 +0200 "ilya77@gmail.com" wrote: > Hi Guys, > > PHP_FUNCTION(proc_close) doesn't have a call to > CloseHandle(proc->child), to close the process handle. > This is causing a handle leak on Windows, and eventually brings the > whole OS to it's knees. > > Here's the fixed code snippet (there's a DIFF at the end of the file): > > CloseHandle(proc->child);// ilya.1.0 20041110 First of all, this will work only under M$ systems and there are plenty of others, that will be broken by your patch. Second, handles are destroyed by proc_open_rsrc_dtor(), so I'd propose the patch below instead: Index: proc_open.c =================================================================== RCS file: /repository/php-src/ext/standard/proc_open.c,v retrieving revision 1.29 diff -u -r1.29 proc_open.c --- proc_open.c 29 Sep 2004 06:04:36 -0000 1.29 +++ proc_open.c 10 Nov 2004 16:03:32 -0000 @@ -219,6 +219,7 @@ WaitForSingleObject(proc->child, INFINITE); GetExitCodeProcess(proc->child, &wstatus); FG(pclose_ret) = wstatus; + CloseHandle(proc->child); #elif HAVE_SYS_WAIT_H -- Wbr, Antony Dovgal aka tony2001 tony2001@phpclub.net || antony@dovgal.com