Bug #77260 [Com]: preg_match_all(): JIT compilation failed: no more memory

From: Date: Sun, 14 Jul 2019 10:07:45 +0000
Subject: Bug #77260 [Com]: preg_match_all(): JIT compilation failed: no more memory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-221766@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77260&edit=1 ID: 77260 Comment by: mc12345678 at mc12345678 dot com Reported by: ettore at themecraft dot studio Summary: preg_match_all(): JIT compilation failed: no more memory Status: Open Type: Bug Package: PCRE related Operating System: macOS 10.13.6 PHP Version: 7.3.0 Block user comment: N Private report: N New Comment: Working with Zen Cart, most recently the development version 1.5.7 available from https://github.com/zencart/zencart. With the following server characteristics: Server OS: Linux 4.14.117-grsec-grsec+ Server Date: 07/14/2019 02:03:38 Server Up Time: 02:03:38 up 6 days, 18:52, 0 users, load average: 3.28, 3.85, 3.73 HTTP Server: Apache PHP Version: 7.3.6 (Zend: 3.3.6) PHP File Uploads: On Upload Max Size: 2M PHP Memory Limit: 512M POST Max Size: 8M Database Engine: MySQL 5.7.25-log Database Date: 07/14/2019 02:03:38 Database Data Size: 458 kB Database Index Size: 559 kB MySQL Slow Query Log Status: On MySQL Slow Query Log File: /dh/mysql/logs/mysql.leberman.slow MySQL Mode: NO_ENGINE_SUBSTITUTION Software is ableto use a few instances of a preg_xxxx function, but then appears to run out of memory. Increasing the memory limit has had no positive impact on the generation of warning messages. So far other than potentially substituting another filter type method (strstr, strops, etc...), the only successful way of preventing the warnings has been some php.ini related disablement of jcre.jit 0 either directly in the php.ini (affecting all code that executes that php.ini file) or from within using '@ini_set("pcre.jit", "0");'. A suggestion has been made to disable using .htaccess; however, this particular software product does not use a base .htaccess file. The recommended coding was: 'php_value pcre.jit 0'. Someone using the same software on a Macintosh was able to operate without any such additional action. Discussion is provided here: https://github.com/zencart/zencart/pull/2537 Previous Comments: ------------------------------------------------------------------------ [2019-06-20 18:45:11] self at danpock dot me @erik, what do you think the issue on Mac OS is then? AFAIK, Mac doesn't have SE Linux - though I'm unsure if it has something similar? ------------------------------------------------------------------------ [2019-06-19 05:36:31] erik at coretech dot se This is probably not a bug but selinux blocking php from fiddling with executable stacks. This is probably a bad idea to enable on a hardened system and should be disabled within php.ini (pcre.jit=0) To check if this generated a selinux warning use: aureport --avc 1. 06/19/2019 07:17:05 httpd system_u:system_r:httpd_t:s0 9 process execmem system_u:system_r:httpd_t:s0 denied 240395 If you still want to enable this, use: setsebool -P httpd_execmem on /Erik Lundin ------------------------------------------------------------------------ [2019-05-13 07:44:11] mathieu dot ferment at prestashop dot com Same issue when trying to run composer install on prestashop project (ithub.com/PrestaShop/PrestaShop/). php7.3 installed using homebrew $ /usr/local/Cellar/php/7.3.5/bin/php composer.phar install PHP Fatal error: Uncaught ErrorException: preg_match_all(): JIT compilation failed: no more memory in phar:///Users/mFerment/www/prestashop/PrestaShop/composer.phar/vendor/symfony/console/Formatter/OutputFormatter.php:137 Worked around it by switching pcre.jit from 1 to 0. PHP 7.3.5 (cli) (built: May 2 2019 12:42:24) ( NTS ) ------------------------------------------------------------------------ [2019-03-13 07:25:16] ilya at ilya dot pp dot ua openSUSE Tumbleweed PHP 7.3.1 (In 7.3.2 patch for pcre.jit=0) https://bugzilla.opensuse.org/show_bug.cgi?id=1124446 https://bugs.php.net/bug.php?id=77260 In PHP 7.3 using pcre2 and using by default JIT compilation (pcre.jit=1) This leads to errors like: Warning in ./libraries/classes/Config.php#201 preg_match(): JIT compilation failed: no more memory For everything that uses preg_*() I get this error on the login screen in phpMyAdmin 4.8.5, while I have 128MB RAM allocated for PHP! Until this is dealt with in the upstream. I suggest set in php.ini pcre.jit=0 ------------------------------------------------------------------------ [2019-03-01 20:22:23] veraxcloud at gmail dot com Here same problem with centos 7 and PHP 7.3.2 FPM. First noticed on "Wordpresss W3 Total Cache" with the minifying process but also on other Projects seen. Disabling JIT compilation solved the problem also here. :) ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=77260 -- Edit this bug report at https://bugs.php.net/bug.php?id=77260&edit=1

« previous php.bugs (#221766) next »