Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:87254 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14530 invoked from network); 23 Jul 2015 18:47:31 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Jul 2015 18:47:31 -0000 Authentication-Results: pb1.pair.com smtp.mail=cmbecker69@gmx.de; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=cmbecker69@gmx.de; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmx.de designates 212.227.15.19 as permitted sender) X-PHP-List-Original-Sender: cmbecker69@gmx.de X-Host-Fingerprint: 212.227.15.19 mout.gmx.net Received: from [212.227.15.19] ([212.227.15.19:60838] helo=mout.gmx.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 26/00-13746-CB631B55 for ; Thu, 23 Jul 2015 14:47:25 -0400 Received: from [192.168.0.100] ([95.89.139.132]) by mail.gmx.com (mrgmx001) with ESMTPSA (Nemesis) id 0MA9Yv-1ZBRlB2oIL-00BOSj; Thu, 23 Jul 2015 20:47:20 +0200 Message-ID: <55B136BE.8010006@gmx.de> Date: Thu, 23 Jul 2015 20:47:26 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: Pierre Joye CC: PHP internals References: <55B0CADD.8000807@gmx.de> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Provags-ID: V03:K0:cU//0b/CEHeMdd75TeMx1OTtVx8qKOgvuzVAmSbkKwBptuBWg9z moXK+uYHcEfkIuSeZxQ57HnWr1OZuOgjz9JgMoqp8E5JRyKEIShS19XAEiIVF6hrj5Tc3DA KXhqfdkWvId9dcEIFemJeZjcQj7Nw624/BCRYMYbh8hGFqUerPNllOHOHpN1EXh88b+4v/r omlixt5LktUFa2UBDJmNQ== X-UI-Out-Filterresults: notjunk:1;V01:K0:jkcdCm/qFTw=:CDoixuZ6PMCeOcv8MvfSjy lQV34qwEaKuUcEcbgzZ+Fr9r4DUGfPP6/uqCZGcayDRm4rSrncAzReupyu5fNlZnS+sVjQLEt v/DPJ2b4Bo7DCN3eGe2emA9TY9KOLp4kknuQgKQbdXlFhwWlzHRYoLth74VmynPfGdr6KJSrm 73CbYigO4+feKvSsm3Gyu6AnMdIJPeeiIiAZLcn641CjDLfsFgMDYxFZFZaVKOwrLdcFnAFKs DB/2+0s+BiZH1GRe5/ZbHtBKxreC3vvgDKE7u//RH3Tbxj83v0P9ukYPZNvKj4EuZOA0GOdxh cOtH4nQfeE8nHWyOmNtW58xmVBsPpaIHFQj9onX/W047xK+nE0x9I1PnNGOw5bDSqgNtUgdsK ilHsPEZTGCtJOzmVEbFfWmWqCEJkPEnsXpUF9UDV1sz7M3Dv2iVn/fBw7lBzkT/VE+5ZKtbOa q46jgYDBPeChgcu7w1fIh3ggfBQkEbfgm06vtVNqBf9k8gnYGqdOltgrseTeGPJgcbycNOHJK PxLxIJBsXqUZxjzNTSfLiXubVoc4JbwlrN8SdMS8WvDmlPbMp/PDke5fgMWyiWuMrKqz3KXHT 3dfJNCIyDOsaM5MQMqImNaPgj2KjeUx4k6pJoZqHBTy/BiyUfvam0qy9hPYvU7p01G5MSk2A9 M5r66BdRrs0/FPKOHKfggba0xWYu6A/uXBhgy149hIQhZqAAwITajLU0W5KVrTQe4YoA= Subject: Re: [PHP-DEV] PCRE JIT stack size limit From: cmbecker69@gmx.de (Christoph Becker) Hi Pierre, Pierre Joye wrote: > Hi Christoph, > > There are ways to dymacally increase the stack. Apache's modphp can use the > apache config. Fpm, fcgi or cli can change it on windows (afair it is in > the doc). It is possible too on Linux with ulimit. > > An alternative (not a big fan) would be to use setrlimit with an ini > setting. Ah, I should have explained better that libpcre's JIT support is implemented as own virtual machine, and libpcre has functions to use a custom stack which is allocated on the heap. If these functions are not used (as it's now in ext/pcre) a fixed 32K on the machine stack are used.[1] Anyhow, it is not possible to change the stack (size) during a call to pcre_exec() (unless, maybe, libpcre would be modified), and it is not possible (to my knowledge) to calculate the required stack size in advance. The required stack size depends on pattern and subject. So basically, we have to call pcre_exec(), and if it fails due to limited stack size, we either fail as well, or we try again. In the latter case we could either use a bigger stack or do without JIT. In the former case we should at least give users a setting to choose the desired stack size, which is quite comparable to pcre.backtrack_limit and pcre.recursion_limit. Therefore I tend to prefer a new ini setting (say, pcre.jitstack_limit). That would mean, however, to add yet another ini setting, of which there are already so many. [1] -- Christoph M. Becker