Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:91798 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 41365 invoked from network); 20 Mar 2016 23:30:25 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Mar 2016 23:30:25 -0000 Authentication-Results: pb1.pair.com header.from=dz@heroku.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dz@heroku.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain heroku.com designates 74.125.82.52 as permitted sender) X-PHP-List-Original-Sender: dz@heroku.com X-Host-Fingerprint: 74.125.82.52 mail-wm0-f52.google.com Received: from [74.125.82.52] ([74.125.82.52:32999] helo=mail-wm0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id DF/CB-48999-B823FE65 for ; Sun, 20 Mar 2016 18:30:20 -0500 Received: by mail-wm0-f52.google.com with SMTP id l68so132811177wml.0 for ; Sun, 20 Mar 2016 16:30:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=heroku-com.20150623.gappssmtp.com; s=20150623; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=oV+25uaOeJj92xo5zDYHr/JCvsJ+lf6hmOoV46QGQrA=; b=dmDjAgsQsAa+Qne35EuYX7cYh64vTMwoBw5lE1oEfeLl2Upei287DotTgd4K5iE3qQ 2ShJtWLhnwehyr0BjFweMcTDIe1zQ2WyiroAvKOESA38vZLOO9Fy8dauaXjrI7FMeNxI nqqVVCwI1vGSDcCmEqhmdGxUGBhP8amlDrAGAEr+osZ50GjUY47KOQXVm7vc9pS1TBeT gOH2r+tif65sZ/OP6fBizH2Jt1GgZuGte5NUp+sauSm/O6flU+k31lJhkZO1WMYFprSa b5L8+aT60VkIavEtMdyoT2d3m1YNNIl625tsRyCK3Cicj58agmnVF2GLqXprTG/CwlYz 1hQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=oV+25uaOeJj92xo5zDYHr/JCvsJ+lf6hmOoV46QGQrA=; b=BC/gatyq0mupPCdC7yXsjOlbQoVmxdBllq+8S5I/l4Jv0oI0ux+txtglTK+JrBqCRs UBgU/cztxhqyoM7Cf8hM+mkSUZzrnEu8k+2por6Ywh9Be5sJ70jGtMT8NhBtdGXCcaxk YAz/bbMxANIiKJ1DWVZoNUe4ricrEwB2LAJYY+7pO9MpJ59SRMhbg/cBHlnBfb3PGquH DvA/9yCrh1gGmaT6lJpReLcSrseW8DVmsuyrf+KSfzmlSqRghOoBUsqrP4eITcURJzqA tOPGZkMprVvus5NwCFUooAV9H0J0p/NQsE3hY5G7kA01KH7mOO+yX9EYK1QcgGPBQDwu 9i1w== X-Gm-Message-State: AD7BkJKy6CSH389/+8P7jCmdfx9j0mUxAVdYO04ju3yCmOml0rR258Ifz7x45kzNGST03Pff X-Received: by 10.28.136.19 with SMTP id k19mr10083298wmd.11.1458516616757; Sun, 20 Mar 2016 16:30:16 -0700 (PDT) Received: from [192.168.19.20] (ipb21b5588.dynamic.kabel-deutschland.de. [178.27.85.136]) by smtp.gmail.com with ESMTPSA id l135sm9817379wmb.13.2016.03.20.16.30.15 (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 20 Mar 2016 16:30:15 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 9.2 \(3112\)) In-Reply-To: <099201d182f1$3c954600$b5bfd200$@belski.net> Date: Mon, 21 Mar 2016 00:30:14 +0100 Cc: Christoph Becker , Pierre Joye , PHP internals Content-Transfer-Encoding: quoted-printable Message-ID: <7DF19331-9967-47C8-B21D-260C619BBD5E@heroku.com> References: <55B0CADD.8000807@gmx.de> <55B136BE.8010006@gmx.de> <046401d0c644$9cf76880$d6e63980$@belski.net> <55B2B78A.4080202@gmx.de> <048001d0c665$ed19ec40$c74dc4c0$@belski.net> <55B2D779.9090409@gmx.de> <04d301d0c6e5$6b28f0c0$417ad240$@belski.net> <55B3B2E6.7080905@gmx.de> <056e01d0c7d9$b1edd990$15c98cb0$@belski.net> <55B559C7.9060304@gmx.de> <064301d0c85f$5260ac60$f7220520$@belski.net> <55C008B1.2050008@gmx.de> <05ec01d0ce97$4ee7c4e0$ecb74ea0$@belski.net> <55C09EE2.7010400@gmx.de> <063f01d0cec2$91b9baf0$b52d30d0$@belski.net> <55C0F908.2050708@gmx.de> <068e01d0cefb$6ffba3e0$4ff2eba0$@belski.net> <016e01d17ef7$cd8a2660$689e7320$@belski.net> <25D67B35-88FF-4A5C-9421-BAF482B32A96@heroku.com> <036501d17fc3$d51357e0$7f3a07a0$@belski.net> <5E36AA30-831F-44BE-A148-8720B8E87E96@heroku.com> <94A89B0F-48BB-4DD8-A26B-3B6D2C8C2C9F@heroku.com> <099201d182f1$3c954600$b5bfd200$@belski.net> To: Anatol Belski X-Mailer: Apple Mail (2.3112) Subject: Re: [PHP-DEV] PCRE JIT stack size limit From: dz@heroku.com (David Zuelke) > On 20.03.2016, at 22:41, Anatol Belski wrote: >=20 > Hi, >=20 >> -----Original Message----- >> From: David Zuelke [mailto:dz@heroku.com] >> Sent: Sunday, March 20, 2016 10:10 PM >> To: Anatol Belski >> Cc: Christoph Becker ; Pierre Joye >> ; PHP internals >> Subject: Re: [PHP-DEV] PCRE JIT stack size limit >>=20 >>> On 17.03.2016, at 05:22, David Zuelke wrote: >>>=20 >>>> On 16.03.2016, at 21:38, Anatol Belski = wrote: >>>>=20 >>>> Hi, >>>>=20 >>>>> -----Original Message----- >>>>> From: David Zuelke [mailto:dz@heroku.com] >>>>> Sent: Tuesday, March 15, 2016 11:58 PM >>>>> To: Anatol Belski >>>>> Cc: Christoph Becker ; Pierre Joye >>>>> ; PHP internals >>>>> Subject: Re: [PHP-DEV] PCRE JIT stack size limit >>>>>=20 >>>>> Sure. So composer creates patterns to parse a file dynamically; I >>>>> have not figured out why it only happens for some composer.json >>>>> files (or maybe it happens for all of them and I just have not >>>>> noticed), but this example here I extracted from a reproducibly >>>>> failing "composer require" run; it runs into the JIT stack size = limit > on PHP 7 >> while it works fine on 5.x: >>>>>=20 >>>>> https://gist.github.com/dzuelke/cc64a630c14416eda3e9 >>>>>=20 >>>> I've just tried this on Debian Jessie and on Windows with the = latest > 7.0.x >> builds, in both cases the error is PREG_BACKTRACK_LIMIT_ERROR. I'd be = next >> asking you to check the configuration. Runtime like system or ini, or > build config >> can affect this. Anyway, I don't see an issue with PCRE JIT at the = moment. >>>=20 >>> Sorry, I simplified the example too far. Updated it again to throw a = JIT > stack >> limit error again (but works fine with "php -dpcre.jit=3D0"): >>>=20 >>> = https://gist.github.com/dzuelke/cc64a630c14416eda3e9/de7b7293798ac57b4 >>> f75d822dc22a625be0fe9df >>=20 >> Were you able to reproduce this? :) >>=20 > Yes, it is reproducible. I was just investigating on another issue > https://bugs.exim.org/show_bug.cgi?id=3D1803 which now seems = unrelated. With > the JIT stack - we can try to use a custom stack to increase its size = by > allocating a custom jit stack of an increased sizeas a workaround. If = that > works, it should be fine. I'll be working on a patch next week, then = we can > see this option makes sense. More on the topic is readable here > http://www.pcre.org/original/doc/html/pcrejit.html#stackcontrol . That sounds good. I suspect a significantly larger stack size than the = PCRE default of 32k will do the job for most cases. Arguably, what = Composer uses there is not a trivial pattern with all the nesting going = on, but I was unable to simplify it when I took a few minutes the other = day, and while the composer.json where the bug occurs is generated by = code, I don't think it qualifies as an extreme case. I guess though that some day, someone with a more complex pattern and/or = subject string will come with the same problem and say "this fails for = me, the 256k stack limit you set in PHP is not enough", so maybe an INI = option should exist? Although that's not terribly useful if one program = needs it for one pattern. Flags don't work well for this (unless it's = e.g. a numeric one indicating multiples of 128k or something, but that's = also terrible). Or change the pcre_match (et al) implementations to retry without JIT if = the error occurs? David