Edit report at https://bugs.php.net/bug.php?id=77260&edit=1
ID: 77260
Comment by: sbarex at gmail 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:
I have same problem with php 7.3 installed via homebrew on mojave (both with bottle package or
compiled from source).
If i use xdebug extension no page can be viewed (php-fpm kill the child process).
If use php from command line without xdebug php works but kill when I use pcre functions.
Also if I use psysh (REPL cli) php crash on every command.
In all cases the code "crashed on child side of fork pre-exec" on php_pcre2_jit_compile or
php_pcre2_jit_match.
This is a crash report:
Process: php [24544]
Path: /usr/local/Cellar/php/7.3.0/bin/php
Identifier: php
Version: 0
Code Type: X86-64 (Native)
Parent Process: ??? [24543]
Responsible: php [24544]
User ID: 501
Date/Time: 2018-12-07 21:58:04.395 +0100
OS Version: Mac OS X 10.14.2 (18C54)
Report Version: 12
Bridge OS Version: 3.2 (16P2542)
System Integrity Protection: enabled
Crashed Thread: 0 Dispatch queue: com.apple.main-thread
Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x0000000106928478
Exception Note: EXC_CORPSE_NOTIFY
Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [24544]
VM Regions Near 0x106928478:
MALLOC_LARGE 0000000106828000-0000000106918000 [ 960K] rw-/rwx SM=COW
-->
VM_ALLOCATE 0000000106a00000-0000000107000000 [ 6144K] rw-/rwx SM=COW
Application Specific Information:
crashed on child side of fork pre-exec
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 php 0x0000000102d4a4fe jit_compile + 42782
1 php 0x0000000102d3fd82 php_pcre2_jit_compile + 78
2 php 0x0000000102d8371b pcre_get_compiled_regex_cache + 1808
3 php 0x0000000102d8725b php_do_pcre_match + 203
4 php 0x00000001030f4116 ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER + 81
5 php 0x00000001030abd32 execute_ex + 98
6 php 0x00000001030abeae zend_execute + 318
7 php 0x0000000103070cfa zend_execute_scripts + 277
8 php 0x000000010301c58f php_execute_script + 639
9 php 0x000000010311c78b do_cli + 3857
10 php 0x000000010311b70c main + 1108
11 libdyld.dylib 0x00007fff7a21ced9 start + 1
Previous Comments:
------------------------------------------------------------------------
[2018-12-07 17:15:49] cmb@php.net
@nikic Indeed, you're right. This is not about the JIT stack,
but rather about the machine stack. From the docs[1]:
| There is a limit to the size of pattern that JIT supports,
| imposed by the size of machine stack that it uses.
I found an SO question which may be related[2], in which case this
wouldn't be Wordpress specific.
[1] <https://www.pcre.org/current/doc/html/pcre2jit.html#SEC3>
[2] <https://stackoverflow.com/questions/52718706/php-pcre2-no-more-memory>
------------------------------------------------------------------------
[2018-12-07 14:05:30] nikic@php.net
@cmb: Wouldn't that generate a JIT_STACKLIMIT rather than NOMEMORY error?
------------------------------------------------------------------------
[2018-12-07 14:03:32] cmb@php.net
> Warning: preg_match_all(): JIT compilation failed: no more
> memory
This warning is trigged, because pcre2_jit_compile() returns
PCRE2_ERROR_NOMEMORY, which hints at a too small JIT stack.
------------------------------------------------------------------------
[2018-12-07 13:42:49] ettore at themecraft dot studio
Description:
------------
I'm experiencing an intermittent issue with WordPress 5.0 running on PHP 7.3.0:
[07-Dec-2018 13:37:11 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/functions.php on line 4885
[07-Dec-2018 13:37:11 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/functions.php on line 4781
[07-Dec-2018 13:37:11 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/functions.php on line 4885
[07-Dec-2018 13:37:11 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/l10n.php on line 1202
[07-Dec-2018 13:37:11 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/functions.php on line 4885
[07-Dec-2018 13:37:11 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/l10n.php on line 1235
[07-Dec-2018 13:37:11 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/class-requests.php on line 563
[07-Dec-2018 13:37:11 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/Requests/IRI.php on line 329
[07-Dec-2018 13:37:11 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/Requests/IRI.php on line 764
[07-Dec-2018 13:37:11 UTC] PHP Warning: preg_replace_callback(): JIT compilation failed: no more
memory in wp-includes/Requests/IRI.php on line 422
[07-Dec-2018 13:37:11 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/Requests/IRI.php on line 425
[07-Dec-2018 13:37:11 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/Requests/IDNAEncoder.php on line 115
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/class-requests.php on line 652
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/class-requests.php on line 654
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/class-requests.php on line 667
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/class-requests.php on line 752
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/functions.php on line 4885
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace_callback(): JIT compilation failed: no more
memory in wp-includes/formatting.php on line 4382
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace_callback(): JIT compilation failed: no more
memory in wp-includes/kses.php on line 724
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/option.php on line 900
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/general-template.php on line 705
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_match_all(): JIT compilation failed: no more memory in
wp-includes/formatting.php on line 229
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_split(): JIT compilation failed: no more memory in
wp-includes/formatting.php on line 235
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/formatting.php on line 289
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/formatting.php on line 295
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-admin/admin-header.php on line 75
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/option.php on line 1021
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-admin/admin-header.php on line 163
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-admin/menu-header.php on line 14
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-admin/menu-header.php on line 15
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-admin/menu-header.php on line 16
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-admin/menu-header.php on line 17
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-admin/menu-header.php on line 108
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/formatting.php on line 4674
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/formatting.php on line 4549
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/functions.php on line 111
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/functions.php on line 112
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/functions.php on line 113
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/functions.php on line 114
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/functions.php on line 115
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-includes/functions.php on line 116
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/functions.php on line 122
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_split(): JIT compilation failed: no more memory in
wp-admin/includes/class-core-upgrader.php on line 239
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_replace(): JIT compilation failed: no more memory in
wp-admin/update-core.php on line 220
[07-Dec-2018 13:37:12 UTC] PHP Warning: preg_match(): JIT compilation failed: no more memory in
wp-includes/formatting.php on line 4768
I am not able to reproduce the issue by singling out any specific preg_* function and parameters.
The ony way I can reproduce the issue is with a clean install of WordPress 5.0.
Below there's php -i:
PHP Version => 7.3.0
System => Darwin iMac.local 17.7.0 Darwin Kernel Version 17.7.0: Wed Oct 10 23:06:14 PDT 2018;
root:xnu-4570.71.13~1/RELEASE_X86_64 x86_64
Build Date => Dec 7 2018 12:22:53
Configure Command => './configure' '--prefix=/Users/ettore/.php/7.3.0'
'--with-config-file-path=/Users/ettore/.php' '--enable-cli'
'--with-apxs2' '--disable-cgi' '--without-pear'
'--enable-pcntl' '--enable-bcmath' '--enable-mbstring'
'--enable-intl' '--enable-soap' '--enable-zip'
'--with-libzip' '--with-zlib-dir=/usr' '--with-pdo-mysql'
'--with-mysqli' '--with-curl' '--with-openssl=/usr/local/opt/openssl'
'--with-gd' '--with-jpeg-dir=/usr/local' '--with-png-dir=/usr/local'
'--with-libedit' '--with-xsl'
'--with-libxml-dir=/usr/local/opt/libxml2' '--with-xmlrpc'
'--with-gmp'
Server API => Command Line Interface
Virtual Directory Support => disabled
Configuration File (php.ini) Path => /Users/ettore/.php
Loaded Configuration File => /Users/ettore/.php/php.ini
Scan this dir for additional .ini files => (none)
Additional .ini files parsed => (none)
PHP API => 20180731
PHP Extension => 20180731
Zend Extension => 320180731
Zend Extension Build => API320180731,NTS
PHP Extension Build => API20180731,NTS
Debug Build => no
Thread Safety => disabled
Zend Signal Handling => enabled
Zend Memory Manager => enabled
Zend Multibyte Support => provided by mbstring
IPv6 Support => enabled
DTrace Support => disabled
Registered PHP Streams => https, ftps, compress.zlib, php, file, glob, data, http, ftp, phar, zip
Registered Stream Socket Transports => tcp, udp, unix, udg, ssl, tls, tlsv1.0, tlsv1.1, tlsv1.2
Registered Stream Filters => zlib.*, convert.iconv.*, string.rot13, string.toupper,
string.tolower, string.strip_tags, convert.*, consumed, dechunk
This program makes use of the Zend Scripting Language Engine:
Zend Engine v3.3.0-dev, Copyright (c) 1998-2018 Zend Technologies
php.ini:
[PHP]
short_open_tag = Off
max_execution_time = 600
memory_limit = 512M
post_max_size = 256M
upload_max_filesize = 128M
error_reporting = E_ALL
display_errors = On
display_startup_errors = On
log_errors = On
log_errors_max_len = 1024
ignore_repeated_errors = On
request_order = "GP"
zend.assertions = 1
assert.exception = On
pcre.jit = On
[CLI Server]
cli_server.color = On
[mysqlnd]
mysqlnd.collect_statistics = On
mysqlnd.collect_memory_statistics = On
[Xdebug]
;zend_extension = xdebug.so
xdebug.remote_enable = 1
xdebug.profiler_output_dir=/Users/ettore/Workspace/xdebug_profiling
xdebug.profiler_output_name=%u.%R
xdebug.profiler_enable_trigger=1
;xdebug.remote_log = /Users/ettore/Workspace/xdebug/xdebug.log
xdebug.var_display_max_data = 2048
NOTICE that the issue appears with both XDebug 2.7.0beta1 disabled and enabled.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=77260&edit=1