Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:64179 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 10387 invoked from network); 6 Dec 2012 11:42:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Dec 2012 11:42:10 -0000 Authentication-Results: pb1.pair.com smtp.mail=keisial@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=keisial@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.44 as permitted sender) X-PHP-List-Original-Sender: keisial@gmail.com X-Host-Fingerprint: 74.125.82.44 mail-wg0-f44.google.com Received: from [74.125.82.44] ([74.125.82.44:60560] helo=mail-wg0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 04/04-19753-19480C05 for ; Thu, 06 Dec 2012 06:42:09 -0500 Received: by mail-wg0-f44.google.com with SMTP id dr12so2982820wgb.11 for ; Thu, 06 Dec 2012 03:42:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=gQKV9zKJ1VEfqcY6y3WtvPKOg1k34vKQy+dZKa6A9K0=; b=VKBM7Mf3VEolQclgNXXdgtE6/XKfJF3UPcqPDGI3PBjkdvG/CHUyEl515nNK7dIxbt GE/9lWdNh+6g6m2RIT2uQxAzI9qNglxI5UxGSCtoCoaCeUSLmeQ3aKb+lIBbkatrCVgB xGEpKDKszJ35APpQOxXaSSB+OcaOR2vAWPTD3t2msu0Qkncf+MHSI2qr5HSMiimGKJoL MdGfL1R2i0XkI/4QBFwgIWnUX2694OSOwjyJU6DsTphDlFaqx4H2Izo0AwjjYpEAP27D 0yJiNkq+XEoQf2oCU63DLMMQaRFOZwvMNecjIMc84okkGRMpkVmBJS2hY4b4qzQba4BQ VU8g== Received: by 10.180.95.169 with SMTP id dl9mr8504046wib.20.1354794126274; Thu, 06 Dec 2012 03:42:06 -0800 (PST) Received: from [192.168.1.26] (228.red-80-28-70.adsl.dynamic.ccgg.telefonica.net. [80.28.70.228]) by mx.google.com with ESMTPS id dm3sm22782398wib.9.2012.12.06.03.42.04 (version=SSLv3 cipher=OTHER); Thu, 06 Dec 2012 03:42:05 -0800 (PST) Message-ID: <50C0841E.6000507@gmail.com> Date: Thu, 06 Dec 2012 12:40:14 +0100 User-Agent: Thunderbird MIME-Version: 1.0 To: Pierre Joye CC: PHP internals References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Passing process handles to proc_open and co From: keisial@gmail.com (=?ISO-8859-1?Q?=C1ngel_Gonz=E1lez?=) On 06/12/12 09:49, Pierre Joye wrote: > hi! > > While looking at the bug #63073, I was wondering if we could simply do > not pass open handles to the newly created child process. Looking at proc_open, where there is an explicit CreateProcess (we seem to be using the library popen for the exec()...) If $pipes is empty and $descriptorspec doesn't require more than 0,1,2 then it should be safe not to set bInheritHandles. However, in other cases inheriting handles *will* be needed. > The main issue in this bug is the session related handles. They are > passed to the parent process, which hangs until their are closed. It > indeed does not happen (usually) until the end of the request. It > makes these functions almost unusable as soon as sessions are used. > > These functions are about calling external commands and I fail to see > which usage may require to access PHP related handles. Does anyone see > any issue by not passing them anymore? And fixing this bug (and a > couple of other I think)? > > It is windows only. Not sure if we do the same on other platforms. The issue was only detected with session files. Windows is probably the only mainstream OS without F_SETFD. When it's available, mod_files.c will set the FD_CLOEXEC, which should remove the issue from the session. The same issue could still arise from other files, though. For instance bug 44994 reported that it was happening with error.log. I don't know *why* session files are an issue. It would make sense if they were pipes and the reading was missed with the inherited child unkowingly holding a write descriptor, but these are plain files. Maybe related to the fact that they are locked, if the locks are also inherited, plus the way Windows may delay its automatic UnlockFile() after the process closes.