Bug #65559 [Com]: Opcache: cache not cleared if changes occur while running

From: Date: Tue, 19 Nov 2013 14:04:28 +0000
Subject: Bug #65559 [Com]: Opcache: cache not cleared if changes occur while running
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-182829@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=65559&edit=1

 ID:                 65559
 Comment by:         arjen at react dot com
 Reported by:        zoeslam at gmail dot com
 Summary:            Opcache: cache not cleared if changes occur while
                     running
 Status:             Assigned
 Type:               Bug
 Package:            opcache
 Operating System:   Ubuntu
 PHP Version:        5.5.3
 Assigned To:        dmitry
 Block user comment: N
 Private report:     N

 New Comment:

-d opcache.revalidate_freq=0  will result in OPcache checking for updates on every request.

You change the content DURING the request, so OPcache won't check for updates during the
request.

http://www.php.net/manual/en/apc.configuration.php#ini.apc.stat
"This defaults to on, forcing APC to stat (check) the script on each request to determine if it
has been modified."

Reads the same as opcache.revalidate. Because of your bugreport I guess apc.stat=1 checks the file
on disk for modification on every include/require. And not just once per request, which is quite
different..


Previous Comments:
------------------------------------------------------------------------
[2013-11-19 13:52:48] zoeslam at gmail dot com

Well, just tested with

php -d opcache.enable=1 -d opcache.enable_cli=1 -d opcache.revalidate_freq=0 test.php

and the result is the same, int(1), so the issue is still alive.

------------------------------------------------------------------------
[2013-11-19 13:46:45] Terry at ellisons dot org dot uk

Why is this a problem? This is the analog of apc.stat.  The only material difference here is that
apc.stat=1 by default.  OPcache defaults are different, but this is clearly documented.  If you want
OPcache always to revalidate scripts, then set opcache.revalidate_freq=0 as per README and
documentation.

------------------------------------------------------------------------
[2013-11-04 14:54:52] zoeslam at gmail dot com

Maybe you are right, but this is a huge inconsistency, difference and compatibility break from APC,
which was the default opcache in 5.4.

(Just tested with Opcache disabled and php -d extension=apc.so -d apc.enabled=1 -d apc.enable_cli=1
test.php)

------------------------------------------------------------------------
[2013-11-04 14:48:41] arjen at react dot com

Don't think this is a bug. opcache_invalidate()/opcache_reset() isn't called after the
updated file is written to disk, so the opcache just doesn't know the file on disk has changed.
The timestamps are only validated every 2 sec. by default, but only once per request.

See http://www.php.net/manual/en/opcache.configuration.php#ini.opcache.revalidate-freq
and Speed Tuning @ https://github.com/zendtech/ZendOptimizerPlus

------------------------------------------------------------------------
[2013-10-23 14:09:38] zoeslam at gmail dot com

Of course, if you try the test in CLI, make sure to enable the opcache even in the cli:

php -d opcache.enable=1 -d opcache.enable_cli=1 test.php

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


The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at

    https://bugs.php.net/bug.php?id=65559


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


Thread (13 messages)

« previous php.bugs (#182829) next »