Skip to content

fix(database): stop logging per page load and leaking two listeners - #1125

Merged
kesselb merged 1 commit into
feat/database-checksfrom
fix/database-page-regressions
Sep 9, 2026
Merged

kesselb merged 1 commit into
feat/database-checksfrom
fix/database-page-regressions

Conversation

@karlitschek

Copy link
Copy Markdown
Member

Stacked on #1124, which is stacked on #1123 and #1119. Both problems were introduced by those PRs, so if you would rather not carry a follow-up commit I am happy to fold this into them instead and drop this PR — say the word.

Two regressions the database page brought with it.

A warning in the log on every page load

A rule whose formula cannot be evaluated was logged at warning level. That is not an exceptional condition: a variable that is not numeric on this particular server is ordinary — MariaDB reports concurrent_insert as AUTO where MySQL reports an integer — and it happens on every single run.

The effect compounded badly. Every visit to the database page wrote a warning to nextcloud.log, and those entries are counted by core's "Errors in the log" setup check — on the very Overview page #1124 adds the database warning to. One new feature was quietly degrading another.

Measured on a MariaDB instance:

failed to evaluate formula lines
three check runs, before +3
three check runs, after 0

Nothing is lost by dropping the level. The rule already reports itself as skipped with the reason attached, which is where an admin should read it:

id        : Concurrent_insert_off
status    : skipped
skipReason: Formula could not be evaluated: Identifier 'concurrent_insert' is not numeric

The log line was only ever diagnostic detail, so it is now debug. The apply-descriptor failure sitting next to it stays a warning on purpose: that one means a rule is written wrong, rather than that this server is different from the one the rule was written for.

Two leaked event listeners

visibilitychange in the live charts and hashchange on the settings page were both registered with anonymous handlers and never removed — anonymous meaning they could not be removed. Both are now named and taken off in onUnmounted, which is what useLiveData already did and what I should have copied the first time.

The practical impact is small on a page mounted once per load, but it is the exact bug I flagged as avoided elsewhere, so it should not stand.

Note for upstream

The underlying Concurrent_insert_off rule is still wrong for MariaDB — it should skip cleanly on a flavour that reports the variable as a string, rather than failing to evaluate. That belongs in DB Doctor, where the rule comes from; fixing it here would diverge the ported copy and make the next re-sync harder.

eslint, php-cs-fixer and psalm clean; the committed js/css reproduce from a fresh build.

Two problems the database page introduced.

A rule whose formula cannot be evaluated was logged as a warning. That is
not an exceptional condition: a variable that is not numeric on this
particular server is ordinary — MariaDB reports concurrent_insert as AUTO
where MySQL reports an integer — and it happens on every run. The effect
was a warning written to nextcloud.log every time the page was opened,
which then inflated the "Errors in the log" setup check on the same
Overview page the database warning was added to. Verified on a MariaDB
instance: three runs used to add three lines, and now add none.

Nothing is lost by dropping the level. The rule already reports itself as
skipped with the reason attached, which is where an admin should read it;
the log line was only ever diagnostic detail. The apply-descriptor failure
next to it stays a warning, because that one means a rule is written wrong
rather than that the server is different.

The other problem was two event listeners registered with anonymous
handlers and never removed: visibilitychange in the live charts and
hashchange on the settings page. Both are now named and taken off on
unmount, which is what useLiveData already does.

Signed-off-by: Frank Karlitschek <frank.karlitschek@nextcloud.com>
Assisted-by: Claude Code:claude-opus-5
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@karlitschek

Copy link
Copy Markdown
Member Author

Base automatically changed from feat/database-setup-check to feat/database-checks September 9, 2026 17:32
@kesselb
kesselb merged commit 1f3914c into feat/database-checks Sep 9, 2026
41 checks passed
@kesselb
kesselb deleted the fix/database-page-regressions branch September 9, 2026 17:33
@karlitschek

Copy link
Copy Markdown
Member Author

/backport to stable35

@backportbot

backportbot Bot commented Sep 9, 2026

Copy link
Copy Markdown

The backport to stable35 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable35
git pull origin stable35

# Create the new backport branch
git checkout -b backport/1125/stable35

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts, resolve them
git cherry-pick 69909cda

# Push the cherry pick commit to the remote repository and open a pull request
git push origin backport/1125/stable35

Error: Failed to check for changes with origin/stable35: No changes found in backport branch


Learn more about backports at https://docs.nextcloud.com/server/stable/go.php?to=developer-backports.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants