php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #80450 JIT config in PHP-FPM
Submitted: 2020-12-01 10:57 UTC Modified: 2021-01-16 01:08 UTC
Votes:5
Avg. Score:4.0 ± 0.9
Reproduced:5 of 5 (100.0%)
Same Version:3 (60.0%)
Same OS:1 (20.0%)
From: vagiz at kaifas dot lt Assigned:
Status: Open Package: *Configuration Issues
PHP Version: 8.0.1 OS: CentOS 8
Private report: No CVE-ID: None
 [2020-12-01 10:57 UTC] vagiz at kaifas dot lt
Description:
------------
Case 1:
file 10-opcache.ini has additional lines:
opcache.jit_buffer_size=256M
opcache.jit=1255


PHP-FPM has additional lines:
php_value[opcache.jit] = 1255
php_value[opcache.jit_buffer_size] = 105M

phpinfo() output:
JIT 	On
opcache.jit	1255	1255
opcache.jit_bisect_limit	0	0
opcache.jit_blacklist_root_trace	16	16
opcache.jit_blacklist_side_trace	8	8
opcache.jit_buffer_size	105M	105M
opcache.jit_debug	0	0
opcache.jit_hot_func	127	127
opcache.jit_hot_loop	64	64
opcache.jit_hot_return	8	8
opcache.jit_hot_side_exit	8	8
opcache.jit_max_exit_counters	8192	8192
opcache.jit_max_loop_unrolls	8	8
opcache.jit_max_polymorphic_calls	2	2
opcache.jit_max_recursive_calls	2	2
opcache.jit_max_recursive_returns	2	2
opcache.jit_max_root_traces	1024	1024
opcache.jit_max_side_traces	128	128
opcache.jit_prof_threshold	0.005	0.005


var_dump(opcache_get_status()['jit']) output:

array(7) {
  ["enabled"]=>
  bool(true)
  ["on"]=>
  bool(true)
  ["kind"]=>
  int(5)
  ["opt_level"]=>
  int(5)
  ["opt_flags"]=>
  int(6)
  ["buffer_size"]=>
  int(268435440)
  ["buffer_free"]=>
  int(268431584)
}

Looks like opcache.jit_buffer_size is different.





Case 2:

Case 1:
file 10-opcache.ini has no any additional variables.

PHP-FPM has additional lines:
php_value[opcache.jit] = 1255
php_value[opcache.jit_buffer_size] = 105M


var_dump(opcache_get_status()['jit']) output:
array(7) {
  ["enabled"]=>
  bool(false)
  ["on"]=>
  bool(false)
  ["kind"]=>
  int(5)
  ["opt_level"]=>
  int(4)
  ["opt_flags"]=>
  int(6)
  ["buffer_size"]=>
  int(0)
  ["buffer_free"]=>
  int(0)
}

phpinfo() output:

JIT 	Disabled 
opcache.enable	On
opcache.jit	tracing	tracing
opcache.jit_bisect_limit	0	0
opcache.jit_blacklist_root_trace	16	16
opcache.jit_blacklist_side_trace	8	8
opcache.jit_buffer_size	105M	105M
opcache.jit_debug	0	0
opcache.jit_hot_func	127	127
opcache.jit_hot_loop	64	64
opcache.jit_hot_return	8	8
opcache.jit_hot_side_exit	8	8
opcache.jit_max_exit_counters	8192	8192
opcache.jit_max_loop_unrolls	8	8
opcache.jit_max_polymorphic_calls	2	2
opcache.jit_max_recursive_calls	2	2
opcache.jit_max_recursive_returns	2	2
opcache.jit_max_root_traces	1024	1024
opcache.jit_max_side_traces	128	128
opcache.jit_prof_threshold	0.005	0.005


It leads me to confusion.
I've been following https://stitcher.io/blog/php-8-jit-setup guide.

I'm using https://rpms.remirepo.net/ , the latest version:
PHP -v: 
PHP 8.0.0 (cli) (built: Nov 24 2020 17:04:03) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.0-dev, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.0, Copyright (c), by Zend Technologies



Is it possible to enable jit via FPM?
p.s. I'm happy to provide full details/files on this case.



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-01 11:00 UTC] vagiz at kaifas dot lt
copy paste mistake:
in the first message <..>Case 2:

Case 1:<..>

should be "Case 2:" only
 [2020-12-01 11:28 UTC] cmb@php.net
This *might* be related to bug #80419.
 [2021-01-16 01:08 UTC] vagiz at kaifas dot lt
-Operating System: CentOS Linux release 8.2.2004 (C +Operating System: CentOS 8 -PHP Version: 8.0.0 +PHP Version: 8.0.1
 [2021-01-16 01:08 UTC] vagiz at kaifas dot lt
I decided to re-tested and summarize it again:
php -v returns:

PHP 8.0.1 (cli) (built: Jan  5 2021 13:54:54) ( NTS gcc x86_64 )
Copyright (c) The PHP Group
Zend Engine v4.0.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.0.1, Copyright (c), by Zend Technologies




CONFIGURATION #1:

opcache part from phpinfo():

opcache.blacklist_filename	/etc/opt/remi/php80/php.d/opcache*.blacklist	/etc/opt/remi/php80/php.d/opcache*.blacklist
opcache.consistency_checks	0	0
opcache.dups_fix	Off	Off
opcache.enable	On	On
opcache.enable_cli	On	On
opcache.enable_file_override	Off	Off
opcache.error_log	no value	no value
opcache.file_cache	no value	no value
opcache.file_cache_consistency_checks	On	On
opcache.file_cache_only	Off	Off
opcache.file_update_protection	2	2
opcache.force_restart_timeout	180	180
opcache.huge_code_pages	On	On
opcache.interned_strings_buffer	16	16
opcache.jit	1255	1255
opcache.jit_bisect_limit	0	0
opcache.jit_blacklist_root_trace	16	16
opcache.jit_blacklist_side_trace	8	8
opcache.jit_buffer_size	240M	240M
opcache.jit_debug	0	0
opcache.jit_hot_func	127	127
opcache.jit_hot_loop	64	64
opcache.jit_hot_return	8	8
opcache.jit_hot_side_exit	8	8
opcache.jit_max_exit_counters	8192	8192
opcache.jit_max_loop_unrolls	8	8
opcache.jit_max_polymorphic_calls	2	2
opcache.jit_max_recursive_calls	2	2
opcache.jit_max_recursive_returns	2	2
opcache.jit_max_root_traces	1024	1024
opcache.jit_max_side_traces	128	128
opcache.jit_prof_threshold	0.005	0.005
opcache.lockfile_path	/tmp	/tmp
opcache.log_verbosity_level	1	1
opcache.max_accelerated_files	40000	40000
opcache.max_file_size	0	0
opcache.max_wasted_percentage	5	5
opcache.memory_consumption	64	64
opcache.opt_debug_level	0	0
opcache.optimization_level	0x7FFEBFFF	0x7FFEBFFF
opcache.preferred_memory_model	no value	no value
opcache.preload	no value	no value
opcache.preload_user	no value	no value
opcache.protect_memory	Off	Off
opcache.record_warnings	Off	Off
opcache.restrict_api	no value	no value
opcache.revalidate_freq	60	60
opcache.revalidate_path	Off	Off
opcache.save_comments	On	On
opcache.use_cwd	On	On
opcache.validate_permission	On	On
opcache.validate_root	On	On
opcache.validate_timestamps	Off	Off





var_dump(opcache_get_status()['jit']) returns:

array(7) {
  ["enabled"]=>
  bool(true)
  ["on"]=>
  bool(true)
  ["kind"]=>
  int(5)
  ["opt_level"]=>
  int(5)
  ["opt_flags"]=>
  int(6)
  ["buffer_size"]=>
  int(268435440)
  ["buffer_free"]=>
  int(268396912)
}

"cat /etc/opt/remi/php80/php.d/10-opcache.ini |grep jit" returns:
opcache.jit_buffer_size=256M
opcache.jit=1255


"cat /etc/php-fpm.d/domains/*|grep jit" returns:
php_value[opcache.jit] = 1255
php_value[opcache.jit_buffer_size] = 240M




CONFIGURATION #2:

opcache part from phpinfo():

opcache.blacklist_filename	/etc/opt/remi/php80/php.d/opcache*.blacklist	/etc/opt/remi/php80/php.d/opcache*.blacklist
opcache.consistency_checks	0	0
opcache.dups_fix	Off	Off
opcache.enable	On	On
opcache.enable_cli	On	On
opcache.enable_file_override	Off	Off
opcache.error_log	no value	no value
opcache.file_cache	no value	no value
opcache.file_cache_consistency_checks	On	On
opcache.file_cache_only	Off	Off
opcache.file_update_protection	2	2
opcache.force_restart_timeout	180	180
opcache.huge_code_pages	On	On
opcache.interned_strings_buffer	16	16
opcache.jit	tracing	tracing
opcache.jit_bisect_limit	0	0
opcache.jit_blacklist_root_trace	16	16
opcache.jit_blacklist_side_trace	8	8
opcache.jit_buffer_size	240M	240M
opcache.jit_debug	0	0
opcache.jit_hot_func	127	127
opcache.jit_hot_loop	64	64
opcache.jit_hot_return	8	8
opcache.jit_hot_side_exit	8	8
opcache.jit_max_exit_counters	8192	8192
opcache.jit_max_loop_unrolls	8	8
opcache.jit_max_polymorphic_calls	2	2
opcache.jit_max_recursive_calls	2	2
opcache.jit_max_recursive_returns	2	2
opcache.jit_max_root_traces	1024	1024
opcache.jit_max_side_traces	128	128
opcache.jit_prof_threshold	0.005	0.005
opcache.lockfile_path	/tmp	/tmp
opcache.log_verbosity_level	1	1
opcache.max_accelerated_files	40000	40000
opcache.max_file_size	0	0
opcache.max_wasted_percentage	5	5
opcache.memory_consumption	64	64
opcache.opt_debug_level	0	0
opcache.optimization_level	0x7FFEBFFF	0x7FFEBFFF
opcache.preferred_memory_model	no value	no value
opcache.preload	no value	no value
opcache.preload_user	no value	no value
opcache.protect_memory	Off	Off
opcache.record_warnings	Off	Off
opcache.restrict_api	no value	no value
opcache.revalidate_freq	60	60
opcache.revalidate_path	Off	Off
opcache.save_comments	On	On
opcache.use_cwd	On	On
opcache.validate_permission	On	On
opcache.validate_root	On	On
opcache.validate_timestamps	Off	Off


var_dump(opcache_get_status()['jit']) returns:
array(7) {
  ["enabled"]=>
  bool(false)
  ["on"]=>
  bool(false)
  ["kind"]=>
  int(5)
  ["opt_level"]=>
  int(4)
  ["opt_flags"]=>
  int(6)
  ["buffer_size"]=>
  int(0)
  ["buffer_free"]=>
  int(0)
}


"cat /etc/opt/remi/php80/php.d/10-opcache.ini |grep jit" returns:
;opcache.jit_buffer_size=256M
;opcache.jit=1255

"cat /etc/php-fpm.d/domains/*|grep jit" returns :
php_value[opcache.jit] = 1255
php_value[opcache.jit_buffer_size] = 240M



I'm using multi-master-multi-version setup. 
Or in other words, every user can have multi-version php-fpm and own opcache at the same time.
However, I'm not able to enable/disable JIT via php-fpm config (only via opcache.ini, globally).

question: is there a way to do that via fpm config?


CONFIGURATION #1:
"opcache.jit_buffer_size=256M" is set in opcache.ini file,
"php_value[opcache.jit_buffer_size] = 240M" is set in FPM config.
Function call to opcache_get_status() ['jit'] returns 268435440 as "buffer_size".
phpinfo() returns "opcache.jit_buffer_size	240M	240M"


CONFIGURATION #2:
"php_value[opcache.jit_buffer_size] = 240M" is set in FPM config.
Function call to opcache_get_status(), ['jit'] returns 0 as "buffer_size",
however the opcache part from phpinfo() displays "opcache.jit_buffer_size	240M	240M"
 [2021-05-12 09:02 UTC] stefan dot heitmueller at root360 dot de
Hi!

Just discovered the same while trying to setup opcache jit per fpm pool config.

Setting values from fpm config seems to work, it just looks like the module does not get activated.
 [2021-05-12 09:30 UTC] stefan dot heitmueller at root360 dot de
Just tried by activating it globally in /etc/php/8.0/fpm/conf.d/10-opcache.ini (which works) and then selectively disabling it in a pool config using php_admin_value[opcache.jit_buffer_size] = 0, which does not work.
 [2023-06-21 21:56 UTC] matula dot m at gmail dot com
I think this also relates to setting `opcache.interned_strings_buffer` in PHP FPM php.ini .. Eg. to `16` which shows correctly in phpinfo() and also via opcache_get_configuration() as 16

but from opcache_get_status() the output is
['interned_strings_usage']['buffer_size']=6290968
 [2023-06-22 20:58 UTC] matula dot m at gmail dot com
In addition to previous comment, it happens both for PHP 8.1.4 (Win 11) & 8.1.7 (Debian 9)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Dec 01 21:01:32 2024 UTC