Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:13812 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 73728 invoked by uid 1010); 10 Nov 2004 16:22:26 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 71928 invoked from network); 10 Nov 2004 16:22:11 -0000 Received: from unknown (HELO rproxy.gmail.com) (64.233.170.200) by pb1.pair.com with SMTP; 10 Nov 2004 16:22:11 -0000 Received: by rproxy.gmail.com with SMTP id a36so200774rnf for ; Wed, 10 Nov 2004 08:22:11 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:reply-to:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:references; b=o/PcDsDzipFObxnPRV7exLk8FrRtrMufkFwJpSBUpa6corxwfWkz8DRCe4MxIgmNFCEnn0kD8qmqFv83RvgFomYmkirdpL5d9UtQQCFS1IW/Itfpb+ilTPr0LFRinxHWFyKx28kNQpFL5aZ3y0sX/b/qb21NspSRhLr3rGxo92U= Received: by 10.38.66.49 with SMTP id o49mr1231552rna; Wed, 10 Nov 2004 08:22:11 -0800 (PST) Received: by 10.38.70.1 with HTTP; Wed, 10 Nov 2004 08:22:10 -0800 (PST) Message-ID: Date: Wed, 10 Nov 2004 18:22:10 +0200 Reply-To: "ilya77@gmail.com" To: Antony Dovgal Cc: internals@lists.php.net, wez@php.net In-Reply-To: <20041110190818.5964bc98.tony2001@phpclub.net> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit References: <20041110190818.5964bc98.tony2001@phpclub.net> Subject: Re: [PHP-DEV] [PATCH] Bug #30743 - proc_close() causes a handle leak From: ilya77@gmail.com ("ilya77@gmail.com") Hi Antony, Makes sense to me, however, what about TerminateProcess() in PHP_FUNCTION(proc_terminate)? As far as I recall (don't take my word for it), TerminateProcess() closes the handle for you, am I missing something? Can it break things on future releases of the OS? Thanks! On Wed, 10 Nov 2004 19:08:18 +0300, Antony Dovgal wrote: > 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 >