Policy map improperly enforced

With the following policy map, OPcache config is only partially applied.

global:
    version: '8.3'
    workers: 10
    governor: ondemand
    idle_timeout: 300s
    threads: 5
    backlog: 60
    connect: 30s
    resources: { file_size: 4G, oom_adjust: 500 }
    php_settings: { memory_limit: 1G, opcache.memory_consumption: 768M, opcache.jit_buffer_size: 500000000, opcache.jit: tracing, opcache.interned_strings_buffer: 16, opcache.max_accelerated_files: 1048793 }
    privatetmp: null
    log: { level: error, slow_threshold: 0, slow_log: null }
pools: null
blacklist: null
whitelist: null

Any chance to get those options changed?

On a side note, running the following command breaks the php.ini as path is further navigated to form a map in the file, failing with and array to string conversion.

cpcmd php:pool-set-policy site10 php_settings.opcache.memory_consumption 256M

Perhaps a bit more generic command could accept generic options instead:

cpcmd php:pool-set-policy site10 php_settings <key> <value>
cpcmd php:pool-set-policy site10 php_settings opcache.memory_consumption 256M

How are you applying these options? Do you have an override for the template in config/custom?

If I take your data, then run EditDomain --reconfig site1, the following is generated:

; Create a file named config/custom/resources/templates/apache/php/partials/fpm-config-custom.blade.php
; to add any additional directives after this line. These will override any php_admin_value settings
; within here or in a policy map.

php_admin_value[memory_limit] = 1G
php_admin_value[opcache.memory_consumption] = 768M
php_admin_value[opcache.jit_buffer_size] = 500000000
php_admin_value[opcache.jit] = tracing
php_admin_value[opcache.interned_strings_buffer] = 16
php_admin_value[opcache.max_accelerated_files] = 1048793

; Values imported from PHP-FPM policy map take precedence
php_value[session.save_path] = /tmp

And these values are correctly reflected in a PHP-FPM script:

<?php echo implode("\n",array_map(static fn($v, $k) => "{$k} => " . json_encode($v), ini_get_all(), array_keys(ini_get_all())));
opcache.interned_strings_buffer => {"global_value":"16","local_value":"16","access":4}
opcache.max_accelerated_files => {"global_value":"1048793","local_value":"1048793","access":4}
opcache.memory_consumption => {"global_value":"768M","local_value":"768M","access":4}

Thanks for the bug report. This is fixed in edge. API signature remains the same.

1 Like

Indeed that’s what is generated in the php.ini, but that’s not reflected in the phpinfo.

; Create a file named config/custom/resources/templates/apache/php/partials/fpm-config-custom.blade.php
; to add any additional directives after this line. These will override any php_admin_value settings
; within here or in a policy map.

php_admin_value[memory_limit] = 512M
php_admin_value[opcache.memory_consumption] = 128M
php_admin_value[opcache.jit_buffer_size] = 500000000
php_admin_value[opcache.jit] = tracing
php_admin_value[opcache.interned_strings_buffer] = 8
php_admin_value[opcache.max_accelerated_files] = 16229

; Values imported from PHP-FPM policy map take precedence
php_value[session.save_path] = /tmp

Resulting in opcache.jit still being function. I’ll double-check the numbers tho, but I did go for the --reconfig after each edit…

Looks related to PHP bug #80450.

Add a file to site10/fst/etc/phpXX.d/ named lexicographically higher than 01-opcache.ini to overwrite the jit type, then restart the pool.