newrelic / newrelic-php-agent

The New Relic PHP Agent
https://opensource.newrelic.com/projects/newrelic/newrelic-php-agent
Apache License 2.0
118 stars 61 forks source link

PHP Agent logs opcache status warnings when using file only opcache #948

Closed gwharton closed 2 days ago

gwharton commented 1 month ago

Description

PHP : 8.3.10 PHP Agent : 10.22.0.12 php.ini entries

opcache.enable=On
opcache.enable_cli=On
opcache.file_cache=/home/ubuntu/.opcache
opcache.file_cache_only=On

Steps to Reproduce

Run any php command line script and monitor error log

Aug 12 11:03:00 hostname php8.3[665758]: 2024-08-12 11:03:00.285 +0100 (665758 665758) info: attempt daemon connection via '@newrelic'
Aug 12 11:03:00 hostname php8.3[665758]: 2024-08-12 11:03:00.285 +0100 (665758 665758) info: New Relic 10.22.0.12 ("yarrow" - "687e42d2e365") [daemon='@newrelic'  php='8.3.10' zts=no sapi='cli'  pid=665758 ppid=1 uid=1000 euid=1000 gid=1000 egid=1000 backtrace=yes startup=agent os='Linux' rel='6.8.0-1013-aws' mach='x86_64' ver='#14-Ubuntu SMP Thu Jul 25 21' node='hostname ']
Aug 12 11:03:00 hostname php8.3[665758]: 2024-08-12 11:03:00.305 +0100 (665758 665758) warning: User instrumentation from opcache: missing 'scripts' key in status information
Aug 12 11:03:00 hostname php8.3[665758]: 2024-08-12 11:03:00.753 +0100 (665758 665758) warning: User instrumentation from opcache: missing 'scripts' key in status information

Expected Behavior

Module handles file only opcache without warning.

Investigation

php -a
php > print_r(opcache_get_status());
Array
(
    [opcache_enabled] => 
    [file_cache] => /home/ubuntu/.opcache/development
    [file_cache_only] => 1
)
php > print_r(opcache_get_configuration());
Array
(
    [directives] => Array
        (
            [opcache.enable] => 1
            [opcache.enable_cli] => 1
            [opcache.use_cwd] => 1
            [opcache.validate_timestamps] => 1
            [opcache.validate_permission] => 
            [opcache.validate_root] => 
            [opcache.dups_fix] => 
            [opcache.revalidate_path] => 
            [opcache.log_verbosity_level] => 1
            [opcache.memory_consumption] => 536870912
            [opcache.interned_strings_buffer] => 8
            [opcache.max_accelerated_files] => 60000
            [opcache.max_wasted_percentage] => 0.05
            [opcache.force_restart_timeout] => 180
            [opcache.revalidate_freq] => 2
            [opcache.preferred_memory_model] => 
            [opcache.blacklist_filename] => 
            [opcache.max_file_size] => 0
            [opcache.error_log] => 
            [opcache.protect_memory] => 
            [opcache.save_comments] => 1
            [opcache.record_warnings] => 
            [opcache.enable_file_override] => 
            [opcache.optimization_level] => 2147401727
            [opcache.lockfile_path] => /tmp
            [opcache.file_cache] => /home/ubuntu/.opcache/development
            [opcache.file_cache_only] => 1
            [opcache.file_cache_consistency_checks] => 1
            [opcache.file_update_protection] => 2
            [opcache.opt_debug_level] => 0
            [opcache.restrict_api] => 
            [opcache.huge_code_pages] => 
            [opcache.preload] => /home/ubuntu/development/preload.php
            [opcache.preload_user] => ubuntu
            [opcache.jit] => 
            [opcache.jit_buffer_size] => 0
            [opcache.jit_debug] => 0
            [opcache.jit_bisect_limit] => 0
            [opcache.jit_blacklist_root_trace] => 16
            [opcache.jit_blacklist_side_trace] => 8
            [opcache.jit_hot_func] => 127
            [opcache.jit_hot_loop] => 64
            [opcache.jit_hot_return] => 8
            [opcache.jit_hot_side_exit] => 8
            [opcache.jit_max_exit_counters] => 8192
            [opcache.jit_max_loop_unrolls] => 8
            [opcache.jit_max_polymorphic_calls] => 2
            [opcache.jit_max_recursive_calls] => 2
            [opcache.jit_max_recursive_returns] => 2
            [opcache.jit_max_root_traces] => 1024
            [opcache.jit_max_side_traces] => 128
            [opcache.jit_prof_threshold] => 0
            [opcache.jit_max_trace_length] => 1024
        )

    [version] => Array
        (
            [version] => 8.3.10
            [opcache_product_name] => Zend OPcache
        )

    [blacklist] => Array
        (
        )

)

As per php documentation at https://www.php.net/manual/en/function.opcache-get-status.php the function opcache_get_status() only reports status on in memory cache. It will not report status if file only cache is enabled.

image

workato-integration[bot] commented 1 month ago

https://new-relic.atlassian.net/browse/NR-301928