Skip to content

php-fpm 8.4.4 high cpu usage #17806

Open
Open

Description

@jostreff

Description

The following code:

Resulted in this output:

Image

But I expected this output instead:

PHP Version

PHP 8.4.4

Operating System

FreeBSD 14.2-STABLE stable/14-n270410-720d25547745 GENERIC amd64

Activity

  1. devnexen commented on Feb 14, 2025

    @devnexen
    Member

    Hi. We might need more context ; e.g. pool configuration, what kind of web application could it be, was cpu usage significantly lower with previous php releases .. etc ...

  2. jostreff commented on Feb 14, 2025

    @jostreff
    Author

    php.ini:
    [opcache]
    opcache.enable=1
    opcache.enable_cli=1
    opcache.interned_strings_buffer=128
    opcache.max_accelerated_files=20000
    opcache.save_comments=1
    opcache.jit=1235
    opcache.revalidate_freq=0
    opcache.validate_timestamps=1
    opcache.max_accelerated_files=10000
    opcache.memory_consumption=192
    opcache.max_wasted_percentage=10
    opcache.interned_strings_buffer=16
    opcache.fast_shutdown=1
    opcache.jit_buffer_size=500000000

    and php-fpm pool:

    pm.status_path = /fpm-status
    slowlog = log/$pool.log.slow
    security.limit_extensions = .php .php3 .php4 .php5 .php7 .php8
    php_admin_value[upload_max_filesize] = 5M
    php_admin_value[error_reporting] = E_ALL & ~E_NOTICE & ~E_WARNING & ~E_STRICT & ~E_DEPRECATED
    php_admin_value[mysqli.allow_local_infile] = 1

    pm = dynamic
    pm.max_children = 16
    pm.start_servers = 2
    pm.min_spare_servers = 2
    pm.max_spare_servers = 5
    pm.max_requests = 1000
    pm.process_idle_timeout = 60s
    rlimit_files = 131072
    rlimit_core = unlimited
    catch_workers_output = yes

  3. devnexen commented on Feb 14, 2025

    @devnexen
    Member

    Thanks.

    was cpu usage significantly lower with previous php releases

    The reason I ask, often this kind of report comes from major migrations e.g. from 8.2 to 8.4 when behavior differences could be witnessed.

  4. jostreff commented on Feb 14, 2025

    @jostreff
    Author

    i'm experiencing issues since 8.3 that was the reason to try 8.4 and it performs like that since that moment. Only way to lower cpu usage is just restart service via service php_fpm restart.

  5. 8 remaining items

  6. devnexen commented on Feb 15, 2025

    @devnexen
    Member

    Would it be possible to profile your web app ? e.g. pmcstat is able to do it on a cpu cycles level pcmstat -O php-sample.dat -P cycles -T -p <php process ID> might give further clues.

  7. bukka commented on Feb 24, 2025

    @bukka
    Member

    I would guess it won't be related to FPM but the actual execution. Profiling might help with that.

    Try to also comment out pm.max_requests = 200 or set it very high which can lead to too many unnecessary restarts ...

  8. github-actions commented on Mar 11, 2025

    @github-actions

    No feedback was provided. The issue is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so. Thank you.

  9. grisha2217 commented on Mar 13, 2025

    @grisha2217

    Same problem on production server
    I compared 2 configs

    /usr/bin/php8.3 -i > php83.txt
    /usr/bin/php8.4 -i > php84.txt
    diff php83.txt php84.txt | less

    OUTPUT:
    Version & Build Information
    PHP Version:
    8.3: 8.3.17
    8.4: 8.4.4
    Build Date:
    8.3: Mar 10 2025 15:24:50
    8.4: Mar 9 2025 17:05:03
    Configuration Files & Directories
    php.ini Location:
    PHP 8.3 uses: /etc/php/8.3/cli/php.ini
    PHP 8.4 uses: /etc/php/8.4/cli/php.ini
    Additional .ini Files Parsed:
    Almost the same list except PHP 8.4 includes a new file (25-memcached.ini) that isn’t in PHP 8.3.
    Extension Directory:
    8.3: /usr/lib/php/20230831
    8.4: /usr/lib/php/20240924
    Core API & Engine Changes
    PHP API / Extension Build:
    Updated from API20230831 to API20240924.
    Zend Engine:
    8.3: Zend Engine v4.3.17 with OPcache v8.3.17
    8.4: Zend Engine v4.4.4 with OPcache v8.4.4
    Output Formatting Changes
    Syntax Highlighting:
    In PHP 8.3, highlight colors are output using tags.
    In PHP 8.4, these are output using tags.
    Specific Directive & Extension Differences
    FFI Setting:
    ffi.enable changed from preload in 8.3 to On in 8.4.
    libmagic:
    Version changed slightly from 543 to 545.
    IMAP Extension:
    PHP 8.4 now shows an “IMAP extension Version => 1.0.3” entry.
    Memcached Extension:
    PHP 8.4 includes a detailed block showing memcached settings and support (e.g. serializer, compression settings).
    MySQL Native Driver (mysqlnd):
    Updated from version 8.3.17 to 8.4.4 in several places.
    PostgreSQL Settings:
    pgsql.auto_reset_persistent changed from On to Off.
    Session Settings:
    session.sid_bits_per_character changes from 5 to 4.
    session.sid_length changes from 26 to 32.
    OPcache JIT Buffer:
    opcache.jit_buffer_size has been reduced from 128M to 64M.
    Miscellaneous
    Zip Version:
    Updated from 1.22.3 to 1.22.4.
    CLI Binary Reference:
    The underscore variable ($SERVER['']) now reflects the PHP 8.4 binary (/usr/bin/php8.4) instead of PHP 8.3.
    Timing Values:
    Slight differences in REQUEST_TIME_FLOAT and REQUEST_TIME reflecting the moment the CLI started.

  10. devnexen commented on Mar 13, 2025

    @devnexen
    Member

    Same problem on production server I compared 2 configs

    /usr/bin/php8.3 -i > php83.txt /usr/bin/php8.4 -i > php84.txt diff php83.txt php84.txt | less

    OUTPUT: Version & Build Information PHP Version: 8.3: 8.3.17 8.4: 8.4.4 Build Date: 8.3: Mar 10 2025 15:24:50 8.4: Mar 9 2025 17:05:03 Configuration Files & Directories php.ini Location: PHP 8.3 uses: /etc/php/8.3/cli/php.ini PHP 8.4 uses: /etc/php/8.4/cli/php.ini Additional .ini Files Parsed: Almost the same list except PHP 8.4 includes a new file (25-memcached.ini) that isn’t in PHP 8.3. Extension Directory: 8.3: /usr/lib/php/20230831 8.4: /usr/lib/php/20240924 Core API & Engine Changes PHP API / Extension Build: Updated from API20230831 to API20240924. Zend Engine: 8.3: Zend Engine v4.3.17 with OPcache v8.3.17 8.4: Zend Engine v4.4.4 with OPcache v8.4.4 Output Formatting Changes Syntax Highlighting: In PHP 8.3, highlight colors are output using tags. In PHP 8.4, these are output using tags. Specific Directive & Extension Differences FFI Setting: ffi.enable changed from preload in 8.3 to On in 8.4. libmagic: Version changed slightly from 543 to 545. IMAP Extension: PHP 8.4 now shows an “IMAP extension Version => 1.0.3” entry. Memcached Extension: PHP 8.4 includes a detailed block showing memcached settings and support (e.g. serializer, compression settings). MySQL Native Driver (mysqlnd): Updated from version 8.3.17 to 8.4.4 in several places. PostgreSQL Settings: pgsql.auto_reset_persistent changed from On to Off. Session Settings: session.sid_bits_per_character changes from 5 to 4. session.sid_length changes from 26 to 32. OPcache JIT Buffer: opcache.jit_buffer_size has been reduced from 128M to 64M. Miscellaneous Zip Version: Updated from 1.22.3 to 1.22.4. CLI Binary Reference: The underscore variable ($SERVER['']) now reflects the PHP 8.4 binary (/usr/bin/php8.4) instead of PHP 8.3. Timing Values: Slight differences in REQUEST_TIME_FLOAT and REQUEST_TIME reflecting the moment the CLI started.

    Hi @grisha2217, not entirely sure it is "kind of the same" here.
    Is disabling memcached, for example, for a while and restesting a possibility ?

  11. Nations112 commented on Mar 30, 2025

    @Nations112

    Same problem after update from 8.3...
    I have a PHP pool for each project. With this problem, all pools are using the processor. Restarting PHP helps.

  12. boserup commented on May 28, 2025

    @boserup

    We are also noticing similar issues after upgrading to the php:8.4.7-fpm tag in Docker - we moved from php:8.3.17-fpm before. So I don't think this is isolated to FreeBSD. As with OP, we also have Memcached enabled, however it is the AWS variant: https://github.com/awslabs/aws-elasticache-cluster-client-memcached-for-php

    We use the following extensions: sockets intl zip pdo pdo_mysql pcntl gd exif bcmath mbstring curl sqlsrv pdo_sqlsrv opcache + memcached.

    Image

    We also saw an increase in memory usage.

    Image
  13. nbb-content commented on Jun 2, 2025

    @nbb-content

    +1
    We are also noticed similar issues after upgrading from php:8.4.6-fpm to the php:8.4.7-fpm tag in Docker. Jobs got killed due to using 100% CPU, when they were fine before without any issues.

  14. boserup commented on Jun 6, 2025

    @boserup

    In a QA environment we experienced the issue again on php:8.4.7-fpm inside an AWS ECS Fargate container. I managed to gather some intersting metrics @devnexen

    Running uptime tells me the container has been running for just over 7 and a half hours - keep this in mind for later.
    Here is the command output:

    12:44:55 up  7:38,  0 user,  load average: 2.07, 2.12, 2.09
    

    In order to give some background about what is running inside the container, I can share it is running the scheduling part of a Laravel-based application. The container is periodically spawing a PHP process with php artisan schedule:run. This process will then for every scheduled action spawn a new background process: /usr/local/bin/php artisan <command name parameter>.
    There is thus no HTTP-traffic to the container.

    Running htop shows only two of these background PHP processes running for almost 6 and 7 hours. Everything else appears to have ran as expected.

    I sampled a few of the processes running on the machine.

    • 8796 is the scheduled invocation php artisan schedule:run
    • 3920 and 5109 are processes spawned by a previously running instance of php artisan schedule:run

    For 3920 and 5109 I notice nonvoluntary_ctxt_switches is very high.

    Attempts to strace -f -p <pid> the hung PHP processes produce no output, maybe indicating the process is stuck in a blocking syscall? I think this supports the theory that JIT is the culprit, as opcache.enable_cli is true in this application.
    Sadly inspecting kernel operations are unsupported or restricted in ECS Fargate. However the process never recovers, and no userland activity occurs..

    PID 8796

    cat /proc/8796/cmdline
    php artisan schedule:run
    
    cat /proc/8796/status
    Name:	php
    Umask:	0022
    State:	S (sleeping)
    Tgid:	8796
    Ngid:	0
    Pid:	8796
    PPid:	8795
    TracerPid:	0
    Uid:	0	0	0	0
    Gid:	0	0	0	0
    FDSize:	64
    Groups:	0
    NStgid:	8796
    NSpid:	8796
    NSpgid:	8796
    NSsid:	8796
    VmPeak:	  672548 kB
    VmSize:	  672548 kB
    VmLck:	       0 kB
    VmPin:	       0 kB
    VmHWM:	  125252 kB
    VmRSS:	  125252 kB
    RssAnon:	   31728 kB
    RssFile:	   30280 kB
    RssShmem:	   63244 kB
    VmData:	   35100 kB
    VmStk:	     140 kB
    VmExe:	    5056 kB
    VmLib:	  167696 kB
    VmPTE:	     392 kB
    VmSwap:	       0 kB
    HugetlbPages:	       0 kB
    CoreDumping:	0
    THP_enabled:	1
    Threads:	1
    SigQ:	0/30446
    SigPnd:	0000000000000000
    ShdPnd:	0000000000000000
    SigBlk:	0000000000000000
    SigIgn:	0000000001001000
    SigCgt:	0000000004004a07
    CapInh:	0000000000000000
    CapPrm:	00000000a80425fb
    CapEff:	00000000a80425fb
    CapBnd:	00000000a80425fb
    CapAmb:	0000000000000000
    NoNewPrivs:	0
    Seccomp:	2
    Seccomp_filters:	1
    Speculation_Store_Bypass:	vulnerable
    Cpus_allowed:	3
    Cpus_allowed_list:	0-1
    Mems_allowed:	00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
    Mems_allowed_list:	0
    voluntary_ctxt_switches:	744
    nonvoluntary_ctxt_switches:	412
    
    cat /proc/8796/syscall
    230 0x0 0x0 0x7ffe3ca361f0 0x0 0x55a09be347c0 0x0 0x7ffe3ca361d8 0x7f8be09cd503
    
    head -n 20 /proc/8796/maps
    55a07aa00000-55a092a00000 rw-s 00000000 00:01 2564                       /dev/zero (deleted)
    55a092a00000-55a09aa00000 r-xs 18000000 00:01 2564                       /dev/zero (deleted)
    55a09aa00000-55a09ab4b000 r--p 00000000 103:00 1615091                   /usr/local/bin/php
    55a09ac00000-55a09b0f0000 r-xp 00200000 103:00 1615091                   /usr/local/bin/php
    55a09b200000-55a09bf1f000 r--p 00800000 103:00 1615091                   /usr/local/bin/php
    55a09c12f000-55a09c200000 r--p 0152f000 103:00 1615091                   /usr/local/bin/php
    55a09c200000-55a09c208000 rw-p 01600000 103:00 1615091                   /usr/local/bin/php
    55a09c208000-55a09c22a000 rw-p 00000000 00:00 0
    55a0c8fe0000-55a0c9626000 rw-p 00000000 00:00 0                          [heap]
    7f8bd9e00000-7f8bdb200000 rw-p 00000000 00:00 0
    7f8bdb395000-7f8bdb436000 rw-p 00000000 00:00 0
    7f8bdb487000-7f8bdb4b7000 rw-p 00000000 00:00 0
    7f8bdb4b7000-7f8bdb4b9000 r--p 00000000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    7f8bdb4b9000-7f8bdb4c6000 r-xp 00002000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    7f8bdb4c6000-7f8bdb4c8000 r--p 0000f000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    7f8bdb4c8000-7f8bdb4c9000 r--p 00010000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    7f8bdb4c9000-7f8bdb4ca000 rw-p 00011000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    7f8bdb4ca000-7f8bdb4ce000 r--p 00000000 103:00 1707041                   /usr/lib/x86_64-linux-gnu/libzip.so.4.0
    7f8bdb4ce000-7f8bdb4e0000 r-xp 00004000 103:00 1707041                   /usr/lib/x86_64-linux-gnu/libzip.so.4.0
    7f8bdb4e0000-7f8bdb4e5000 r--p 00016000 103:00 1707041                   /usr/lib/x86_64-linux-gnu/libzip.so.4.0
    
    ls -l /proc/8796/fd
    total 0
    lr-x------ 1 root root 64 Jun  6 12:26 0 -> /dev/null
    l-wx------ 1 root root 64 Jun  6 12:26 1 -> 'pipe:[30325]'
    lrwx------ 1 root root 64 Jun  6 12:26 10 -> 'socket:[622667]'
    lrwx------ 1 root root 64 Jun  6 12:26 11 -> 'socket:[622679]'
    l-wx------ 1 root root 64 Jun  6 12:26 2 -> 'pipe:[30325]'
    lrwx------ 1 root root 64 Jun  6 12:26 3 -> '/memfd:opcache_lock (deleted)'
    lr-x------ 1 root root 64 Jun  6 12:26 4 -> /var/www/application/artisan
    l-wx------ 1 root root 64 Jun  6 12:26 5 -> 'pipe:[30325]'
    lrwx------ 1 root root 64 Jun  6 12:26 6 -> 'socket:[622093]'
    lrwx------ 1 root root 64 Jun  6 12:26 7 -> 'socket:[622664]'
    lrwx------ 1 root root 64 Jun  6 12:26 8 -> 'socket:[622665]'
    lrwx------ 1 root root 64 Jun  6 12:26 9 -> 'socket:[622666]'
    

    PID 3920

    cat /proc/3920/cmdline
    /usr/local/bin/php artisan <redacted command name>
    
    cat /proc/3920/status
    Name:	php
    Umask:	0022
    State:	R (running)
    Tgid:	3920
    Ngid:	0
    Pid:	3920
    PPid:	3919
    TracerPid:	0
    Uid:	0	0	0	0
    Gid:	0	0	0	0
    FDSize:	64
    Groups:	0
    NStgid:	3920
    NSpid:	3920
    NSpgid:	3888
    NSsid:	3888
    VmPeak:	  813864 kB
    VmSize:	  761680 kB
    VmLck:	       0 kB
    VmPin:	       0 kB
    VmHWM:	  145312 kB
    VmRSS:	  145312 kB
    RssAnon:	   45916 kB
    RssFile:	   29892 kB
    RssShmem:	   69504 kB
    VmData:	   58824 kB
    VmStk:	     140 kB
    VmExe:	    5056 kB
    VmLib:	   36624 kB
    VmPTE:	     440 kB
    VmSwap:	       0 kB
    HugetlbPages:	       0 kB
    CoreDumping:	0
    THP_enabled:	1
    Threads:	1
    SigQ:	0/30446
    SigPnd:	0000000000000000
    ShdPnd:	0000000000000000
    SigBlk:	0000000000000000
    SigIgn:	0000000081001000
    SigCgt:	0000000104004a07
    CapInh:	0000000000000000
    CapPrm:	00000000a80425fb
    CapEff:	00000000a80425fb
    CapBnd:	00000000a80425fb
    CapAmb:	0000000000000000
    NoNewPrivs:	0
    Seccomp:	2
    Seccomp_filters:	1
    Speculation_Store_Bypass:	vulnerable
    Cpus_allowed:	3
    Cpus_allowed_list:	0-1
    Mems_allowed:	00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
    Mems_allowed_list:	0
    voluntary_ctxt_switches:	170
    nonvoluntary_ctxt_switches:	3810619
    
    capsh --decode=0x$(cat /proc/3920/status | grep CapEff | awk '{print $2}')
    0x00000000a80425fb=cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap
    
    cat /proc/3920/syscall
    running
    
    head -n 20 /proc/3920/maps
    558870000000-558890000000 rw-s 00000000 00:01 3096                       /dev/zero (deleted)
    558890000000-55889014b000 r--p 00000000 103:00 1615091                   /usr/local/bin/php
    558890200000-5588906f0000 r-xp 00200000 103:00 1615091                   /usr/local/bin/php
    558890800000-55889151f000 r--p 00800000 103:00 1615091                   /usr/local/bin/php
    55889172f000-558891800000 r--p 0152f000 103:00 1615091                   /usr/local/bin/php
    558891800000-558891808000 rw-p 01600000 103:00 1615091                   /usr/local/bin/php
    558891808000-55889182a000 rw-p 00000000 00:00 0
    5588ca254000-5588ca9a4000 rw-p 00000000 00:00 0                          [heap]
    7f2bdc000000-7f2bdc021000 rw-p 00000000 00:00 0
    7f2bdc021000-7f2be0000000 ---p 00000000 00:00 0
    7f2be0a00000-7f2be1600000 rw-p 00000000 00:00 0
    7f2be17ff000-7f2be1800000 ---p 00000000 00:00 0
    7f2be1800000-7f2be3600000 rw-p 00000000 00:00 0
    7f2be370a000-7f2be37ab000 rw-p 00000000 00:00 0
    7f2be37fc000-7f2be382c000 rw-p 00000000 00:00 0
    7f2be382c000-7f2be382e000 r--p 00000000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    7f2be382e000-7f2be383b000 r-xp 00002000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    7f2be383b000-7f2be383d000 r--p 0000f000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    7f2be383d000-7f2be383e000 r--p 00010000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    7f2be383e000-7f2be383f000 rw-p 00011000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    
    ls -l /proc/3920/fd
    total 0
    lr-x------ 1 root root 64 Jun  6 12:21 0 -> /dev/null
    l-wx------ 1 root root 64 Jun  6 12:21 1 -> /dev/null
    lrwx------ 1 root root 64 Jun  6 12:21 10 -> 'socket:[197453]'
    lrwx------ 1 root root 64 Jun  6 12:21 11 -> 'socket:[197971]'
    lrwx------ 1 root root 64 Jun  6 12:21 12 -> 'socket:[197457]'
    l-wx------ 1 root root 64 Jun  6 12:21 13 -> /dev/null
    lrwx------ 1 root root 64 Jun  6 12:21 14 -> 'socket:[198726]'
    lrwx------ 1 root root 64 Jun  6 12:21 15 -> 'socket:[198761]'
    lrwx------ 1 root root 64 Jun  6 12:21 16 -> 'socket:[198762]'
    lrwx------ 1 root root 64 Jun  6 12:21 17 -> 'socket:[198769]'
    lrwx------ 1 root root 64 Jun  6 12:21 18 -> 'socket:[198770]'
    l-wx------ 1 root root 64 Jun  6 12:21 2 -> /dev/null
    lrwx------ 1 root root 64 Jun  6 12:21 3 -> '/memfd:opcache_lock (deleted)'
    lr-x------ 1 root root 64 Jun  6 12:21 4 -> /var/www/application/artisan
    l-wx------ 1 root root 64 Jun  6 12:21 5 -> 'pipe:[30325]'
    lr-x------ 1 root root 64 Jun  6 12:21 6 -> /var/www/application/artisan
    lrwx------ 1 root root 64 Jun  6 12:21 7 -> 'socket:[197450]'
    lrwx------ 1 root root 64 Jun  6 12:21 8 -> 'socket:[197451]'
    lrwx------ 1 root root 64 Jun  6 12:21 9 -> 'socket:[197452]'
    

    PID 5109

    cat /proc/5109/cmdline
    /usr/local/bin/php artisan <redacted command name>
    
    cat /proc/5109/status
    Name:	php
    Umask:	0022
    State:	R (running)
    Tgid:	5109
    Ngid:	0
    Pid:	5109
    PPid:	5108
    TracerPid:	0
    Uid:	0	0	0	0
    Gid:	0	0	0	0
    FDSize:	64
    Groups:	0
    NStgid:	5109
    NSpid:	5109
    NSpgid:	5086
    NSsid:	5086
    VmPeak:	  813864 kB
    VmSize:	  761680 kB
    VmLck:	       0 kB
    VmPin:	       0 kB
    VmHWM:	  145540 kB
    VmRSS:	  145540 kB
    RssAnon:	   45916 kB
    RssFile:	   30120 kB
    RssShmem:	   69504 kB
    VmData:	   58824 kB
    VmStk:	     140 kB
    VmExe:	    5056 kB
    VmLib:	   36624 kB
    VmPTE:	     436 kB
    VmSwap:	       0 kB
    HugetlbPages:	       0 kB
    CoreDumping:	0
    THP_enabled:	1
    Threads:	1
    SigQ:	0/30446
    SigPnd:	0000000000000000
    ShdPnd:	0000000000000000
    SigBlk:	0000000000000000
    SigIgn:	0000000081001000
    SigCgt:	0000000104004a07
    CapInh:	0000000000000000
    CapPrm:	00000000a80425fb
    CapEff:	00000000a80425fb
    CapBnd:	00000000a80425fb
    CapAmb:	0000000000000000
    NoNewPrivs:	0
    Seccomp:	2
    Seccomp_filters:	1
    Speculation_Store_Bypass:	vulnerable
    Cpus_allowed:	3
    Cpus_allowed_list:	0-1
    Mems_allowed:	00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000000,00000001
    Mems_allowed_list:	0
    voluntary_ctxt_switches:	190
    nonvoluntary_ctxt_switches:	3722472
    
    capsh --decode=0x$(cat /proc/5109/status | grep CapEff | awk '{print $2}')
    0x00000000a80425fb=cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap
    
    cat /proc/5109/syscall
    running
    
    head -n 20 /proc/5109/maps
    55c6db600000-55c6fb600000 rw-s 00000000 00:01 2300                       /dev/zero (deleted)
    55c6fb600000-55c6fb74b000 r--p 00000000 103:00 1615091                   /usr/local/bin/php
    55c6fb800000-55c6fbcf0000 r-xp 00200000 103:00 1615091                   /usr/local/bin/php
    55c6fbe00000-55c6fcb1f000 r--p 00800000 103:00 1615091                   /usr/local/bin/php
    55c6fcd2f000-55c6fce00000 r--p 0152f000 103:00 1615091                   /usr/local/bin/php
    55c6fce00000-55c6fce08000 rw-p 01600000 103:00 1615091                   /usr/local/bin/php
    55c6fce08000-55c6fce2a000 rw-p 00000000 00:00 0
    55c732744000-55c732e94000 rw-p 00000000 00:00 0                          [heap]
    7fe170000000-7fe170021000 rw-p 00000000 00:00 0
    7fe170021000-7fe174000000 ---p 00000000 00:00 0
    7fe174000000-7fe174c00000 rw-p 00000000 00:00 0
    7fe174dff000-7fe174e00000 ---p 00000000 00:00 0
    7fe174e00000-7fe176c00000 rw-p 00000000 00:00 0
    7fe176d17000-7fe176db8000 rw-p 00000000 00:00 0
    7fe176e09000-7fe176e39000 rw-p 00000000 00:00 0
    7fe176e39000-7fe176e3b000 r--p 00000000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    7fe176e3b000-7fe176e48000 r-xp 00002000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    7fe176e48000-7fe176e4a000 r--p 0000f000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    7fe176e4a000-7fe176e4b000 r--p 00010000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    7fe176e4b000-7fe176e4c000 rw-p 00011000 103:00 1224686                   /usr/lib/x86_64-linux-gnu/libbz2.so.1.0.4
    
    ls -l /proc/5109/fd
    total 0
    lr-x------ 1 root root 64 Jun  6 12:23 0 -> /dev/null
    l-wx------ 1 root root 64 Jun  6 12:23 1 -> /dev/null
    lrwx------ 1 root root 64 Jun  6 12:23 10 -> 'socket:[274886]'
    lrwx------ 1 root root 64 Jun  6 12:23 11 -> 'socket:[274896]'
    lrwx------ 1 root root 64 Jun  6 12:23 12 -> 'socket:[274909]'
    l-wx------ 1 root root 64 Jun  6 12:23 13 -> /dev/null
    lrwx------ 1 root root 64 Jun  6 12:23 14 -> 'socket:[271955]'
    lrwx------ 1 root root 64 Jun  6 12:23 15 -> 'socket:[271983]'
    lrwx------ 1 root root 64 Jun  6 12:23 16 -> 'socket:[271984]'
    lrwx------ 1 root root 64 Jun  6 12:23 17 -> 'socket:[271987]'
    lrwx------ 1 root root 64 Jun  6 12:23 18 -> 'socket:[271988]'
    l-wx------ 1 root root 64 Jun  6 12:23 2 -> /dev/null
    lrwx------ 1 root root 64 Jun  6 12:23 3 -> '/memfd:opcache_lock (deleted)'
    lr-x------ 1 root root 64 Jun  6 12:23 4 -> /var/www/application/artisan
    l-wx------ 1 root root 64 Jun  6 12:23 5 -> 'pipe:[30325]'
    lr-x------ 1 root root 64 Jun  6 12:23 6 -> /var/www/application/artisan
    lrwx------ 1 root root 64 Jun  6 12:23 7 -> 'socket:[274883]'
    lrwx------ 1 root root 64 Jun  6 12:23 8 -> 'socket:[274884]'
    lrwx------ 1 root root 64 Jun  6 12:23 9 -> 'socket:[274885]'
    

    Configuration and environment

    php -v
    PHP 8.4.7 (cli) (built: May 21 2025 23:16:11) (NTS)
    Copyright (c) The PHP Group
    Built by https://github.com/docker-library/php
    Zend Engine v4.4.7, Copyright (c) Zend Technologies
        with Zend OPcache v8.4.7, Copyright (c), by Zend Technologies
    
    php -i | grep -E 'jit|opcache|cli'
    /usr/local/etc/php/conf.d/docker-php-ext-opcache.ini,
    auto_globals_jit => On => On
    pcre.jit => On => On
    pdo_sqlsrv.client_buffer_max_kb_size => 10240 => 10240
    cli.pager => no value => no value
    cli.prompt => \b \>  => \b \>
    opcache.blacklist_filename => no value => no value
    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 => /tmp/opcache => /tmp/opcache
    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 => Off => Off
    opcache.interned_strings_buffer => 64 => 64
    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 => 128M => 128M
    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_max_trace_length => 1024 => 1024
    opcache.jit_prof_threshold => 0.005 => 0.005
    opcache.lockfile_path => /tmp => /tmp
    opcache.log_verbosity_level => 1 => 1
    opcache.max_accelerated_files => 30000 => 30000
    opcache.max_file_size => 0 => 0
    opcache.max_wasted_percentage => 10 => 10
    opcache.memory_consumption => 384 => 384
    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 => 0 => 0
    opcache.revalidate_path => Off => Off
    opcache.save_comments => On => On
    opcache.use_cwd => On => On
    opcache.validate_permission => Off => Off
    opcache.validate_root => Off => Off
    opcache.validate_timestamps => Off => Off
    
    php -m
    [PHP Modules]
    bcmath
    Core
    ctype
    curl
    date
    dom
    exif
    fileinfo
    filter
    gd
    hash
    iconv
    intl
    json
    libxml
    mbstring
    memcached
    mysqlnd
    openssl
    pcntl
    pcre
    PDO
    pdo_mysql
    pdo_sqlite
    pdo_sqlsrv
    Phar
    posix
    random
    readline
    redis
    Reflection
    session
    SimpleXML
    sockets
    sodium
    SPL
    sqlite3
    sqlsrv
    standard
    tokenizer
    xml
    xmlreader
    xmlwriter
    Zend OPcache
    zip
    zlib
    
    [Zend Modules]
    Zend OPcache
    
    uname -a
    Linux ip-<redacted>2.eu-central-1.compute.internal 5.10.235-227.919.amzn2.x86_64 #1 SMP Sat Apr 5 16:59:05 UTC 2025 x86_64 GNU/Linux
    
    cat /etc/os-release
    PRETTY_NAME="Debian GNU/Linux 12 (bookworm)"
    NAME="Debian GNU/Linux"
    VERSION_ID="12"
    VERSION="12 (bookworm)"
    VERSION_CODENAME=bookworm
    ID=debian
    HOME_URL="https://www.debian.org/"
    SUPPORT_URL="https://www.debian.org/support"
    BUG_REPORT_URL="https://bugs.debian.org/"
    
    cat /proc/sys/kernel/perf_event_paranoid
    2
    
  15. stfast commented on Apr 3, 2026

    @stfast

    Hi. We might need more context ; e.g. pool configuration, what kind of web application could it be, was cpu usage significantly lower with previous php releases .. etc ...

    Same CPU/load spikes happens to us on latest Nextcloud instance with latest PHP 8.4+ (.19) We did not have problems before with PHP <= 8.3 and do not have problems with other Nextcloud instances with PHP <= 8.3. CPU/load spikes comes randomly, 2 weeks no problems, than few times a day, but always after server restart. PHP-FPM restart helps, sometimes only with explicit stop and start.

    Now I set pm.max_requests = 1 in PHP-FPM pool and Nextcloud instance is more perfomant, load rearly exceeding 1. If it holds for a month, it is some kind of memory leak for sure.

    Image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions