Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:70269 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 79198 invoked from network); 22 Nov 2013 00:06:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 22 Nov 2013 00:06:37 -0000 Authentication-Results: pb1.pair.com smtp.mail=ellison.terry@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=ellison.terry@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.178 as permitted sender) X-PHP-List-Original-Sender: ellison.terry@gmail.com X-Host-Fingerprint: 209.85.212.178 mail-wi0-f178.google.com Received: from [209.85.212.178] ([209.85.212.178:64410] helo=mail-wi0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3A/70-09639-B00AE825 for ; Thu, 21 Nov 2013 19:06:36 -0500 Received: by mail-wi0-f178.google.com with SMTP id ca18so1891385wib.17 for ; Thu, 21 Nov 2013 16:06:32 -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=eaL12ib3IDV2q7Lyl+JcmlFjTg8c0BYIP80VToGLU+I=; b=K7iHDtedZOjIa5xOFbOFqsIuoCn+P/jfvY78gRaZQT59Z1LkBZsxwgxBSWspsnidlL oAJonbeD0TMmywBbkCvXZeiJ55B+ZS9xSh0byek3ZhkMQwhqdmn6vDGgHWQ2tX+kINPJ mHpn8KJ43GtGYimTWCt74wAdQitubVjcRICkmVd9wmYbZI3EKFF6zdRM30pFz+34Z6j4 WavPsL/+UeHtYm35dFCrqtwRY+GLEGYvWMEP0JXpcNKXJbTMuiEJNJ4z6I8jzj+90MhG lE6FYhEbAFyxw0TpD7zEaL1L4JOBvG5vqjNrRBvskyZyhNXT+PqElnr8hJlIvY9HZred g5+g== X-Received: by 10.180.182.198 with SMTP id eg6mr144891wic.21.1385078792358; Thu, 21 Nov 2013 16:06:32 -0800 (PST) Received: from [192.168.1.91] (host81-129-110-107.range81-129.btcentralplus.com. [81.129.110.107]) by mx.google.com with ESMTPSA id f15sm10456654wik.6.2013.11.21.16.06.31 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Nov 2013 16:06:31 -0800 (PST) Message-ID: <528EA006.2090400@gmail.com> Date: Fri, 22 Nov 2013 00:06:30 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.1.0 MIME-Version: 1.0 To: Ferenc Kovacs CC: PHP Internals , Joe Watkins , arjen@react.com References: <528CE64A.1020303@gmail.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Subject: Re: [PHP-DEV] Comments on non-unique naming convention for closures From: ellison.terry@gmail.com (Terry Ellison) On 21/11/13 20:05, Ferenc Kovacs wrote: > > 2013.11.20. 17:42, "Terry Ellison" > ezt írta: > > > > The following bugs relate to this discussion: > > > > #64291 Indeterminate GC of evaled lambda function resources > > #65915 Inconsistent results with require return value > > > > I don't want to discuss these or the specific fixes here, since I can > work up a fix and discuss them in the bugrep. However, > > my one-sentence Q is "should we replace the naming convention for > closures with a truly unique one?" What I would like is some feedback / > guidance / discussion on the general architectural issue which underlies > the reasons for these bugs occuring in the first place.... > > Bumping the thread and ccing Joe as we were having a similar discussion > about the internal naming of the inner classes proposed by him. > Thanks for bumping this. Yup, the current build_runtime_defined_function_key() algo builds the function name on the file name (closures) / the class/function name and LANG_SCNG(yy_text) -- that is the memory address of the class / function token being compiled. This is for closures, inner classes or any class or function within a conditional block. I guess this is on the assumption that this will be unique, but as I have shown in #64291 and #65915 it is fairly straight forward to construct test cases where this assumption is invalid, and arjan seems to be hitting this in real-life OPcache cases. My patch at least demonstrates that having a unique key will fix this, but as submitted (adding a simple sequence) this will only reduces this occurrence. However strictly, this could still fail in OPcache because of sequence duplication across forked PHP children. We really need a UUID-style element in the key say based on the creation microtime (or alternatively start time of request + sequence within request) and PID. Regards Terry