Page MenuHomePhabricator

Confusing login error message when $wgReadOnly is set and $wgSessionCacheType=CACHE_DB
Open, Needs TriagePublicBUG REPORT

Description

Steps to replicate the issue (include links if applicable):

  • Set $wgReadOnly = 'Some text';
  • Go to Special:UserLogin.
  • It displays the login page without mentioning read-only status.
  • Click "Log in".

What happens?:

  • It displays this error message: There seems to be a problem with your login session; this action has been canceled as a precaution against session hijacking. Please resubmit the form.

What should have happened instead?:

  1. The login page should prevent login attempts, saying something like: "The wiki is currently in read-only mode so you cannot log in." plus the contents of $wgReadOnly.
  2. Alternatively, the subsequent error message should say that.

Software version (on Special:Version page; skip for WMF-hosted wikis like Wikipedia):

  • MediaWiki 1.43.6.

Other information (browser name/version, screenshots, etc.):

  • If I am logged in when I set $wgReadOnly it won't let me log out, saying, "The wiki is currently in read-only mode." Something similar when trying to log in would be good.

Event Timeline

Strange, I got the following on MediaWiki 1.45

A database query error has occurred. This may indicate a bug in the software.

[a142e2bd08f00540b80120e5] /w/index.php?title=Special:UserLogin&returnto=Main+Page Wikimedia\Rdbms\DBReadOnlyError: Database is read-only: test

Screenshot 2026-01-19 at 08.56.36.png (1×2 px, 519 KB)

What commit are you on with 1.45? This would look like touched timestamp updates having been restored on login, which is https://gerrit.wikimedia.org/r/c/mediawiki/core/+/1199878, but that change isn't present on the REL1_45 branch.

ah your right, i didn't restart my webserver probably after restart. will look again later today.

Change #1229175 had a related patch set uploaded (by Reeti; author: Reeti):

[mediawiki/core@master] Show clear error on login page when wiki is in read-only mode

https://gerrit.wikimedia.org/r/1229175

I have submitted a patch for review.

Change #1229447 had a related patch set uploaded (by Reeti; author: Reeti):

[mediawiki/core@master] T414883: Fix login error message in read-only mode; removed premature read-only check, updated AuthenticationResponse::FAIL to handle multiple session failure keys, used ->status->getMessage(), and throw ReadOnlyError only when appropriate

https://gerrit.wikimedia.org/r/1229447

Change #1229449 had a related patch set uploaded (by Reeti; author: Reeti):

[mediawiki/core@master] Fix misleading session error during read-only login

https://gerrit.wikimedia.org/r/1229449

Change #1229447 abandoned by Reeti:

[mediawiki/core@master] T414883: Fix login error message in read-only mode; removed premature read-only check, updated AuthenticationResponse::FAIL to handle multiple session failure keys, used ->status->getMessage(), and throw ReadOnlyError only when appropriate

https://gerrit.wikimedia.org/r/1229447

Change #1229449 abandoned by Reeti:

[mediawiki/core@master] Fix misleading session error during read-only login

Reason:

this was a duplicate commit

https://gerrit.wikimedia.org/r/1229449

I have submitted a patch for review.