php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74778 opcache_clear() puts php-fpm master in a cpu loop
Submitted: 2017-06-19 08:35 UTC Modified: 2021-12-01 21:24 UTC
Votes:5
Avg. Score:3.8 ± 1.6
Reproduced:4 of 4 (100.0%)
Same Version:2 (50.0%)
Same OS:1 (25.0%)
From: daniel dot ylitalo at mytaste dot com Assigned: bukka (profile)
Status: Assigned Package: FPM related
PHP Version: 7.1.6 OS: FreeBSD 11.0-RELEASE-p10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
37 - 12 = ?
Subscribe to this entry?

 
 [2017-06-19 08:35 UTC] daniel dot ylitalo at mytaste dot com
Description:
------------
I tried clearing a pools opcache with opcache_reset(); however while the script finishes running, once it completes the fpm-master process goes into some kind of loop using 50% cpu and the pools goes dormant and stops accepting connections

Nginx block:
location /opcache-clear {
        fastcgi_pass    unix:/var/run/php/pool-xyz-socket.sock;
        fastcgi_index   clear.php;
        fastcgi_param   PHP_ADMIN_VALUE "open_basedir=/home/www/clear-opcache.xxxxxxxxxx.com";
        include         fastcgi_params;
        fastcgi_param   SCRIPT_NAME        /clear.php;
        fastcgi_param   SCRIPT_FILENAME    $document_root/clear.php;
}

FPM POOLS consists of this configuration with different listen.owners/users:
[xxxxxxx-xxx]

listen = /var/run/php/pool-xyz-socket.sock

listen.owner = xxxxxxxx
listen.group = www
listen.mode = 0660

user = xx-xx
group = xx-xx

pm = static
pm.max_children = 20

pm.status_path = /fpm-status.php



Test script:
---------------
<?php

$status = opcache_reset();

if($status === true) {
    echo '+OK';
}else{
    echo '+ERROR';
}

Expected result:
----------------
The fpm-master process should not go into a cpu loop and continue serving requests

Actual result:
--------------
fpm sockets stops accepting connections

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-12-01 21:24 UTC] bukka@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: bukka
 [2021-12-01 21:24 UTC] bukka@php.net
I know that this is few years old but would you be able to confirm if this is still happening as there have been bunch of improvements in opcache.

Considering that it was causing extra processing on master process and it's on FreeBSD, it might be related kqueue which has got some issues reported.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat May 11 00:01:31 2024 UTC