Page MenuHomePhabricator

Session "{session}": Metadata merge failed: {exception}
Open, MediumPublic

Description

Session "{session}" Metadata merge failed: exception 'MediaWiki\Session\MetadataMergeException in /srv/mediawiki/php-1.29.0-wmf.12/includes/session/SessionProvider.php:205
Stack trace:
#0 /srv/mediawiki/php-1.29.0-wmf.12/includes/session/SessionManager.php(637): MediaWiki\Session\SessionProvider->mergeMetadata()
#1 /srv/mediawiki/php-1.29.0-wmf.12/includes/session/SessionManager.php(506): MediaWiki\Session\SessionManager->loadSessionInfoFromStore()
#2 /srv/mediawiki/php-1.29.0-wmf.12/includes/session/SessionManager.php(190): MediaWiki\Session\SessionManager->getSessionInfoForRequest()
#3 /srv/mediawiki/php-1.29.0-wmf.12/includes/WebRequest.php(735): MediaWiki\Session\SessionManager->getSessionForRequest()
#4 /srv/mediawiki/php-1.29.0-wmf.12/includes/session/SessionManager.php(129): WebRequest->getSession()
#5 /srv/mediawiki/php-1.29.0-wmf.12/includes/Setup.php(757): MediaWiki\Session\SessionManager::getGlobalSession()
#6 /srv/mediawiki/php-1.29.0-wmf.12/includes/WebStart.php(136): include()
#7 /srv/mediawiki/php-1.29.0-wmf.12/index.php(40): include()
#8 /srv/mediawiki/w/index.php(3): include()
#9 {main}

https://logstash.wikimedia.org/goto/e13abb4a6f31afe6b0671c1480bc6190

Event Timeline

I think this is happening because CentralAuth sets the session source to local for anons? So you get a CA -> Local merge conflict if the session has expired, and maybe a Local -> CA one on login? (They seem to be happening with a comparable frequency.)

Maybe there could be a separate source for anons, which can be merged quietly with anything?

It looks like we have two cases here:

  1. User is not logged in, but has a session with CentralAuthSource = Local. They log in on a different wiki. Then the next page load, CA sees the CA cookies and returns a SessionInfo with CentralAuthSource = CentralAuth. Merge fails with this exception.
  2. User is logged in, and has a session with CentralAuthSource = CentralAuth. They somehow get logged out centrally. Then the next page load, CA sees no or invalid CA cookies and returns a SessionInfo with CentralAuthSource = Local. Merge fails with this exception.

I think in both cases I think it would be safe to implement CentralAuthSessionProvider::mergeMetadata() to always return the old CentralAuthSource value, and also adjust CentralAuthSessionProvider::refreshSessionInfo() to use 'Local' instead of skipping the check entirely when $info->getUserInfo()->getName() === null and reduce its own log message level. Or we could have it "merge" the new value to a different key and have CentralAuthSessionProvider::refreshSessionInfo() reject if that different key is set.

Or we could just reduce the log level of the exception in the first place. That'd certainly be safe.

Or we could just reduce the log level of the exception in the first place. That'd certainly be safe.

Maybe add a severity parameter to ˙MetadataMergeException`? For CentralAuth it seems uninteresting, but maybe for some other provider it only happens when something is being tampered with?

A year later, this is still a fairly common warning in production (~17,000 hits in the past 7 days).

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:10 PM
Aklapper added a subscriber: AMooney.

@AMooney: Assuming that "Set projects" was accidentally used instead of "Add projects", hence restoring some previous project tags.

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

Untagging from production error, since this is a diagnostic warning in the session channel. It is not a runtime error or otherwise an uncaught exception in the error channel.

Krinkle changed the subtype of this task from "Production Error" to "Task".Mar 6 2024, 10:01 PM