Skip to content

[3] Ensure opcache file invalidate on file copy & delete#32918

Closed
PhilETaylor wants to merge 6 commits intojoomla:stagingfrom
PhilETaylor:opcacheonwrite3
Closed

[3] Ensure opcache file invalidate on file copy & delete#32918
PhilETaylor wants to merge 6 commits intojoomla:stagingfrom
PhilETaylor:opcacheonwrite3

Conversation

@PhilETaylor
Copy link
Copy Markdown
Contributor

This is part 2 of #32592 and directed at Joomla 3

Summary of Changes

When PHP is configured to use modern Opcache, PHP will attempt to hold the compiled version cached in memory.

There are many ways to configure opcache invalidations, including never revisiting the source PHP to compile it again ever (if opcache.validate_timestamps is disabled for example)

To fully ensure that files that Joomla writes to the hard disk are taken into account by a server with a correct configured (or badly configured) opcache, we need to invalidate files from the opcache after writing a new version to the disk.

Joomla has previously used opcache_reset to do this, but its clear this is not good enough.

Testing Instructions

Hard to test unless you really know what you are doing and can reconfigure all your PHP stack to include opcaching. Also some of the edge cases this fixes will only become clear if you are an extension developer mass distributing extensions.

Install some extensions - nothing should break.

Actual result BEFORE applying this Pull Request

You can install extensions

Expected result AFTER applying this Pull Request

You can install extensions and opcache for each file is invalidated

Documentation Changes Required

none

// cc @nikosdion

Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>
@richard67
Copy link
Copy Markdown
Member

@PhilETaylor Unit tests failing:

There was 1 error:
1) JFilesystemPatcherTest::testApply with data set "Test delete" ('Index: lao\n==================...ames.\n', 'C:\projects\joomla-cms\tests\...atcher', 0, array('The Way that can be told of i...ames.\n'), array(null), 1, false)
Undefined index: extension
C:\projects\joomla-cms\tests\unit\core\helper.php:55
C:\projects\joomla-cms\libraries\src\Filesystem\File.php:196
C:\projects\joomla-cms\libraries\src\Filesystem\File.php:272
C:\projects\joomla-cms\libraries\src\Filesystem\Patcher.php:187
C:\projects\joomla-cms\tests\unit\suites\libraries\joomla\filesystem\JFilesystemPatcherTest.php:935
FAILURES!

See https://ci.appveyor.com/project/release-joomla/joomla-cms/builds/38443204/job/es3oo3tjn6285q8v?fullLog=true .

Co-authored-by: Richard Fath <richard67@users.noreply.github.com>
@PhilETaylor

This comment was marked as abuse.

@richard67
Copy link
Copy Markdown
Member

@PhilETaylor Did his thumb down come before or after the isset check was added? If before, then it maybe was that.

@PhilETaylor

This comment was marked as abuse.

Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>
@joomla-cms-bot
Copy link
Copy Markdown

Set to "closed" on behalf of @SharkyKZ by The JTracker Application at issues.joomla.org/joomla-cms/32918

@bembelimen bembelimen reopened this Apr 1, 2021
@richard67
Copy link
Copy Markdown
Member

For further discussion I've decided to comment in the J4 PR #32915 .

Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>
@PhilETaylor

This comment was marked as abuse.

Phil E. Taylor added 2 commits April 3, 2021 14:44
Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>
Signed-off-by: Phil E. Taylor <phil@phil-taylor.com>
@PhilETaylor

This comment was marked as abuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants