Req #75939 [Opn]: opcache_invalidate requires file presence

From: Date: Wed, 03 Mar 2021 14:54:44 +0000
Subject: Req #75939 [Opn]: opcache_invalidate requires file presence
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-232518@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75939&edit=1 ID: 75939 User updated by: bjornar dot ness at gmail dot com Reported by: bjornar dot ness at gmail dot com Summary: opcache_invalidate requires file presence Status: Open Type: Feature/Change Request Package: opcache Operating System: n/a PHP Version: 7.2.2 Block user comment: N Private report: N New Comment: Imho, this has nothing to do with fragmentation, if the file exists on disk or not.. Previous Comments: ------------------------------------------------------------------------ [2021-03-03 14:48:30] cmb@php.net > How impossible would it be to implement a opcache_delete call > that would do all this? Not impossible, but inefficient, see "So OPCache is clever about shared memory, and will not fragment it by freeing it and compacting it."[1] [1] <http://blog.jpauli.tech/2015-03-05-opcache-html/> ------------------------------------------------------------------------ [2018-02-08 20:21:00] bjornar dot ness at gmail dot com Description: ------------ opcache_invalidate()/zend_accel_invalidate does: realpath = accelerator_orig_zend_resolve_path(filename, filename_len); if (!realpath) { return FAILURE; } accelerator_orig_zend_resolve_path ends up calling php_resolve_path that again does a tsrm_realpath() that ends up doing lstat() that in the end makes php_resolve_path return NULL and zend_accel_invalidate return FAILURE. This means it is not possible to invalidate a file that is removed from the filesystem without flushing the entire opcache. This can be problematic in general and for esoteric in particular. I understand the fact that one might try to resolve symlinks to find real cache key, but there should imho be a way to override this and enable the invalidation. Another related issue is that opcache_invalidate does not actually free up memory, just marks the cached code as corrupted. How impossible would it be to implement a opcache_delete call that would do all this? ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75939&edit=1

« previous php.bugs (#232518) next »