Skip to content

Conversation

ativarsoft
Copy link

This fixes a massive performance bug when opcache is enabled.

Signed-off-by: Mateus de Lima Oliveira mateus@ativarsoft.com

Signed-off-by: Mateus de Lima Oliveira <mateus@ativarsoft.com>
Check if config file exists before trying to read it.

Signed-off-by: Mateus de Lima Oliveira <mateus@ativarsoft.com>

if ($this->getLastChecksum() == $currentChecksum)
return;

Check failure

Code scanning / Psalm

TaintedHtml

Detected tainted HTML

if ($this->getLastChecksum() == $currentChecksum)
return;

Check failure

Code scanning / Psalm

TaintedHtml

Detected tainted HTML
@szaimen szaimen added the 3. to review Waiting for reviews label Sep 21, 2022
@szaimen szaimen modified the milestones: Nextcloud 25, Nextcloud 26 Sep 21, 2022
Changed comment style to make the linter like it.

Signed-off-by: Mateus de Lima Oliveira <mateus@ativarsoft.com>
@kesselb
Copy link
Collaborator

kesselb commented Sep 21, 2022

As reference: #34099

Thanks for creating a new version of your pull request 👍

Our usual workflow is that pull request target master as branch.
If necessary a patch is backported to the stable* branches (if possible by a bot).

Please don't forget to add the logging output (as requsted in the old pull request) to figure out what the actual issue is. The configuration file is only rewritten (and the opcache cleared) when a change is detected:

if (!isset($this->cache[$key]) || $this->cache[$key] !== $value) {
// Add change
$this->cache[$key] = $value;
return true;
}
return false;

Copy link
Collaborator

@kesselb kesselb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Target branch: master

@ativarsoft ativarsoft changed the base branch from stable24 to master September 21, 2022 16:45
@ativarsoft
Copy link
Author

@kesselb

The log is empty, Daniel.

@kesselb
Copy link
Collaborator

kesselb commented Sep 21, 2022

Hey, when you change the target branch you may need to rebase your pull request. Right now all commits from stable24 which are not in master are also referenced.

@ativarsoft ativarsoft changed the base branch from master to stable24 September 21, 2022 17:58
@ativarsoft
Copy link
Author

@kesselb, I have no idea how to resolve those rebase conflicts.

@kesselb
Copy link
Collaborator

kesselb commented Sep 21, 2022

It depends a bit on your local setup.

When people are working with a fork they usually add another remote "upstream".

git remote add upstream git@github.com:nextcloud/server.git

Then run git fetch upstream.

Afterwards rebase your local branch with the upstream changes git rebase -i upstream/master.

GitHub documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks

@PVince81 PVince81 requested a review from come-nc December 16, 2022 16:54
$data = var_export($this->cache, true);
$currentChecksum = crc32($data);

if ($this->getLastChecksum() == $currentChecksum)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will never be true, the checksum computed from file use the whole file content while the current one use only the data.

@blizzz blizzz mentioned this pull request Feb 1, 2023
@skjnldsv skjnldsv mentioned this pull request Feb 23, 2023
@blizzz blizzz mentioned this pull request Mar 7, 2023
@blizzz blizzz removed this from the Nextcloud 26 milestone Mar 9, 2023
@blizzz
Copy link
Member

blizzz commented Mar 9, 2023

Any reason this PR is against stable24? Do we have a equivalent for master?

@kesselb kesselb closed this Mar 9, 2023
@kesselb
Copy link
Collaborator

kesselb commented Mar 9, 2023

Closing the pull request due to inactivity.

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

Labels

3. to review Waiting for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants