Bug #71621 [Com]: opcache_reset sometimes returns false

From: Date: Mon, 05 Aug 2019 15:15:31 +0000
Subject: Bug #71621 [Com]: opcache_reset sometimes returns false
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-222090@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=71621&edit=1

 ID:                 71621
 Comment by:         mail at franek dot fr
 Reported by:        sts at ono dot at
 Summary:            opcache_reset sometimes returns false
 Status:             Open
 Type:               Bug
 Package:            opcache
 Operating System:   Debian/Jessie
 PHP Version:        5.6.18
 Block user comment: N
 Private report:     N

 New Comment:

Able to reproduce on CentOS 7 with:
PHP 7.3.8 (cli) (built: Jul 30 2019 09:26:16) ( NTS )
Copyright (c) 1997-2018 The PHP Group
Zend Engine v3.3.8, Copyright (c) 1998-2018 Zend Technologies
    with Zend OPcache v7.3.8, Copyright (c) 1999-2018, by Zend Technologies


Previous Comments:
------------------------------------------------------------------------
[2016-05-17 03:57:52] detailyang at gmail dot com

hey, guys.
I make a bet, you havent check opcache status before. So reset code as follow if you can:
    $opcache_status = opcache_get_status();
    if (isset($opcache_status["opcache_enabled"]) &&
!$opcache_status["opcache_enabled"]) {
        echo "opcache empty, so skip it";
        exit(0);
    }

    // now you can reset opcache


have a fun to you:)

------------------------------------------------------------------------
[2016-02-18 08:44:58] sts at ono dot at

Description:
------------
There seems to be a race condition under which opcache_reset() returns false, although the opcache
extension is loaded.

Make sure the opcache extension is loaded. Create the Test script on a webserver and call it a
couple of times. In most cases it will return true, but sometimes it returns false.

Please note I reproduced this on a server where requests are actually coming in.

This also happens during our deployment, where we call opcache_reset() only once. It also happened
among projects with different codebases (Laravel, ZF, self coded), so it doesn't seem to be
related to our code. 

Test script:
---------------
<?php echo opcache_reset();



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=71621&edit=1


Thread (5 messages)

« previous php.bugs (#222090) next »