Opened 14 months ago
Last modified 14 months ago
#60397 assigned defect (bug)
Invalidate opcache after theme / plugin updates
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | 6.4.2 |
Component: | Upgrade/Install | Keywords: | needs-patch dev-feedback reporter-feedback |
Focuses: | Cc: |
Description
Depending on the server opcache configuration, there is a high possibility of getting an Internal Server Error, or similar after updating a plugin / theme.
Specific opchache settings I've verified that trigger the error are:
[opcache] opcache.enable=1 opcache.enable_cli=1 opcache.memory_consumption=256 opcache.interned_strings_buffer=24 opcache.max_accelerated_files=130987 opcache.max_wasted_percentage=2 opcache.use_cwd=1 opcache.validate_timestamps=1 opcache.revalidate_freq=5 opcache.revalidate_path=0 opcache.save_comments=1 opcache.enable_file_override=1
Error happens because validate_timestamps is set to 1 and revalidate_freq is greater than 0. This means that after plugin update, error 500 will stay for up to revalidate_freq seconds due to invalid opcache.
This can be mitigated by adding a opcache_invalidate or opcache_reset call upon successful update.
Change History (3)
#2
@
14 months ago
- Focuses accessibility administration removed
- Keywords reporter-feedback added
- Severity changed from major to normal
Hi there and welcome to WordPress Trac!
Is this happening with manual updates on Dashboard -> Updates or when uploading a new ZIP file? Some steps to reproduce would be helpful.
In most places core uses its own move_dir()
function which already does OPcache invalidation. See wp_opcache_invalidate_directory()
and wp_opcache_invalidate()
. So this kind of issue shouldn't be happening. But if there's a place where this was forgotten, the more info we have the better.
#3
@
14 months ago
Happening on the following places:
- Manual plugin updates via plugin list admin page
- Manual plugin updates via updates admin page
- WP CLI
I've narrowed it down even further.
Exact combination of opcache settings is:
[opcache] opcache.enabla=1 opcache.use_cwd=1 opcache.enable_file_override=1 opcache.validate_timestamps=1 opcache.revalidate_freq=5 opcache.revalidate_path=0
Any number greateer than 0 will work for revalidate_freq
You can reproduce the bug I'm getting by setting these settings, updating a plugin and once you see a success notice, reload the admin page -> bam error 500.
P.S. I'm willing to make a PR and work on the bug.