Page MenuHomePhabricator

Error "Session {session}: Metadata has an anonymous user, but a non-anon user was provided"
Open, MediumPublicPRODUCTION ERROR

Description

type=mediawiki
level=WARNING
channel=session

Session "{session}": Metadata has an anonymous user, but a non-anon user was provided

About 1,200 hits in the last 24 hours:
https://logstash.wikimedia.org/goto/02d3891d4a7de1488e28ef1e0314c598

Seems to be coming from both /w/api.php and /w/index.php.

Event Timeline

It's a session security check. If the session itself is for an anonymous user but the cookies (or whatever) are for a logged-in user, that mismatch prevents use of the session. Chances are these are related to case #1 described at T158365#3036725, and the solutions there would apply here too.

There's no particular evidence of that. I believe that this log message would result in the user being served a new session cookie, and thus would not be the cause of T181876.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:09 PM
Tgr subscribed.

This is not necessarily an error, but really needs better documentation.

Change 1006177 had a related patch set uploaded (by Gergő Tisza; author: Gergő Tisza):

[mediawiki/core@master] session: Improve text and documentation of SessionManager warnings

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

Tgr moved this task from Inbox, needs triage to Current Sprint on the MediaWiki-Platform-Team board.
Tgr removed a project: Wikimedia-production-error.

Not actually a production error, the messages are logged to the session channel.

Change 1006177 merged by jenkins-bot:

[mediawiki/core@master] session: Improve text and documentation of SessionManager warnings

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

Tgr removed Tgr as the assignee of this task.Mar 12 2024, 4:56 PM
Tgr moved this task from Current Sprint to Within 2 Qs on the MediaWiki-Platform-Team board.

Improved the inline docs a little. (Note that the message changed, it is now Session "{session}": the session store entry is for an anonymous user, but the session metadata indicates a non-anonynmous user.) I have two hypotheses of what could be happening:

  • When the user logs out, the login cookies do not get unset for some reason, so the user is left with an anonymous session (is this actually true? do we set the backend session to anonymous on logout, rather than deleting it?) but logged-in cookies. I don't think this explains what's going on, given how frequent the logs are, and failing to unset cookies isn't something that should happen often.
  • When the user logs out on CentralAuth, cookies on domains other than the current one are left in place (T143001: Wiki sites should delete all their cookies during logout). I don't think this would result in this message (those domains would have no session or an invalid logged-in session, not an anonymous session) but maybe I misremember the details of how CentralAuth session invalidation on login works.

We should probably figure this out later, but it's more a peculiarity than a problem so not a priority.