Open
Conversation
karnatmugo
commented
Aug 18, 2023
Context Of Problem
Lock Cleanup
When apache uses mod_php to serve a request, then any locks left open by PHP calls to flock are closed automatically when the request finishes.
This means that under normal use, buggy eZ PHP code that leaves dangling locks is harmless, as these are cleaned up.
However, for long running processes under gearman, this does not happen and dangling locks become dangerous.
eZ has a bug such that if object view cache is prepared using a template which sets cache_ttl to 0 will leave a dangling lock on the cache mutex.
A template doing this will have something like the following sample in it
{set-block scope=global variable=cache_ttl}0{/set-block}
This is in ezpublish_legacy/kernel/classes/clusterfilehandlers/ezfsfilehandler.php, near the end
// Check if we are allowed to store the data, if not just return the result
if ( !$store )
{
$this->abortCacheGeneration();
return $result;
}
// Store content locally
$this->storeContents( $binaryData, $scope, $datatype, true );
$this->_freeExclusiveLock( 'storeCache' );
Here, if the cache ttl is set to zero, $store will be false, and the method will exit before it calls $this->_freeExclusiveLock.
If a lock has been taken, it will be leaked under gearman. Under httpd mod_php or a command line php script, it will be cleaned at the end of the run.
Author
|
@brookinsconsulting This attempts to address your comment on #1468 |
|
SonarCloud Quality Gate failed.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.










