php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #66999 Unnecessary system calls when opcache.validate_timestamps is disabled
Submitted: 2014-04-01 12:48 UTC Modified: 2014-10-21 13:49 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: leonid at komarovsky dot info Assigned: jpauli (profile)
Status: Closed Package: opcache
PHP Version: 5.5.10 OS: Amazon Linux AMI release 2014.03
Private report: No CVE-ID: None
 [2014-04-01 12:48 UTC] leonid at komarovsky dot info
Description:
------------
When opcache.validate_timestamps is disabled, there are still access/stat calls for files that are already in cache.


Expected result:
----------------
No stat/access calls for cached files

Actual result:
--------------
Below is an example of the strace output for the second time the page is requested

25780 access("/var/www/html/test/app/cache/prod/jms_serializer", W_OK) = 0
25780 access("/var/www/html/test/vendor/jms/serializer/src/JMS/Serializer/Naming/IdenticalPropertyNamingStrategy.php", F_OK) = 0
25780 access("/var/www/html/test/vendor/jms/serializer/src/JMS/Serializer/Naming/PropertyNamingStrategyInterface.php", F_OK) = 0
25780 access("/var/www/html/test/vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Formatter/HtmlFormatter.php", F_OK) = 0
25780 access("/var/www/html/test/vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Formatter/AbstractFormatter.php", F_OK) = 0
25780 access("/var/www/html/test/vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Formatter/FormatterInterface.php", F_OK) = 0
25780 access("/var/www/html/test/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Templating/DelegatingEngine.php", F_OK) = 0
25780 access("/var/www/html/test/vendor/symfony/symfony/src/Symfony/Component/Templating/DelegatingEngine.php", F_OK) = 0
25780 access("/var/www/html/test/vendor/symfony/symfony/src/Symfony/Component/Templating/StreamingEngineInterface.php", F_OK) = 0
25780 access("/var/www/html/test/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/TwigEngine.php", F_OK) = 0
25780 access("/var/www/html/test/vendor/symfony/symfony/src/Symfony/Bridge/Twig/TwigEngine.php", F_OK) = 0
25780 access("/var/www/html/test/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php", F_OK) = 0
25780 access("/var/www/html/test/vendor/twig/twig/lib/Twig/Loader/Filesystem.php", F_OK) = 0
25780 access("/var/www/html/test/vendor/twig/twig/lib/Twig/ExistsLoaderInterface.php", F_OK) = 0
25780 stat("/var/www/html/test/app/cache/prod/templates.php", {st_mode=S_IFREG|0775, st_size=18992, ...}) = 0
25780 stat("/var/www/html/test/active_release/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Resources/views", {st_mode=S_IFDIR|S_ISGID|0775, st_size=4096, ...}) = 0
25780 stat("/var/www/html/test/active_release/vendor/symfony/symfony/src/Symfony/Bundle/TwigBundle/Resources/views", {st_mode=S_IFDIR|S_ISGID|0775, st_size=4096, ...}) = 0
25780 stat("/var/www/html/test/active_release/vendor/doctrine/doctrine-bundle/Doctrine/Bundle/DoctrineBundle/Resources/views", {st_mode=S_IFDIR|S_ISGID|0775, st_size=4096, ...}) = 0
25780 stat("/var/www/html/test/active_release/app/Resources/NelmioApiDocBundle/views", {st_mode=S_IFDIR|S_ISGID|0775, st_size=4096, ...}) = 0
25780 stat("/var/www/html/test/active_release/vendor/nelmio/api-doc-bundle/Nelmio/ApiDocBundle/Resources/views", {st_mode=S_IFDIR|S_ISGID|0775,

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2014-10-21 13:49 UTC] jpauli@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: jpauli
 [2014-10-21 13:49 UTC] jpauli@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

Hello,

Unfortunately, OPcache does not permit this.
Before OPcache comes to play, PHP already has checked for every file you ask it to run, and even more : it has open()ed them, thus generating system calls to at least check that the file exists (F_OK), and even more depending on libc's implementation.

Only after the file has been successfully opened, and a file descriptor has been obtained, then the flow is passed to OPCache for furter work.
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Aug 20 01:01:27 2019 UTC