Page MenuHomePhabricator

UnexpectedValueException from line 230 of SessionManager.php - Can neither load the session nor create an empty session
Closed, DeclinedPublic

Description

On current master (3e9d3ec8c208287ded41fcce0adbcf179edb9f39) I was prompted to change my password on my local test instance as my password was "password" and this is no longer allowed.
Upon changing my password the following appeared:

Fatal error: Uncaught exception 'InvalidArgumentException' with message 'Session ID already exists' in mediawiki\includes\session\SessionManager.php on line 230
InvalidArgumentException: Session ID already exists in mediawiki\includes\session\SessionManager.php on line 257
UnexpectedValueException: Can neither load the session nor create an empty session in mediawiki\includes\session\SessionManager.php on line 230

The the following stack in the logs:

2016-01-26 17:45:38 ADSH my_wiki: [f2776f98] /w/index.php/Special:ChangePassword   UnexpectedValueException from line 230 of mediawiki\includes\session\SessionManager.php: Can neither load the session nor create an empty session
#0 mediawiki\includes\WebRequest.php(658): MediaWiki\Session\SessionManager->getSessionById(string, boolean, WebRequest)
#1 mediawiki\includes\WebRequest.php(952): WebRequest->getSession()
#2 mediawiki\includes\user\User.php(4075): WebRequest->getSessionData(string)
#3 mediawiki\includes\user\User.php(4104): User->getEditTokenAtTimestamp(string, WebRequest, string)
#4 mediawiki\includes\resourceloader\ResourceLoaderUserTokensModule.php(47): User->getEditToken()
#5 mediawiki\includes\resourceloader\ResourceLoaderUserTokensModule.php(66): ResourceLoaderUserTokensModule->contextUserTokens(ResourceLoaderContext)
#6 mediawiki\includes\resourceloader\ResourceLoaderModule.php(575): ResourceLoaderUserTokensModule->getScript(ResourceLoaderContext)
#7 mediawiki\includes\resourceloader\ResourceLoaderModule.php(543): ResourceLoaderModule->buildContent(ResourceLoaderContext)
#8 mediawiki\includes\resourceloader\ResourceLoader.php(976): ResourceLoaderModule->getModuleContent(ResourceLoaderContext)
#9 mediawiki\includes\OutputPage.php(2865): ResourceLoader->makeModuleResponse(ResourceLoaderContext, array)
#10 mediawiki\includes\OutputPage.php(3013): OutputPage->makeResourceLoaderLink(string, string)
#11 mediawiki\includes\OutputPage.php(2680): OutputPage->getInlineHeadScripts()
#12 mediawiki\includes\skins\SkinTemplate.php(465): OutputPage->headElement(SkinVector)
#13 mediawiki\includes\skins\SkinTemplate.php(240): SkinTemplate->prepareQuickTemplate(OutputPage)
#14 mediawiki\includes\OutputPage.php(2320): SkinTemplate->outputPage()
#15 mediawiki\includes\MediaWiki.php(753): OutputPage->output()
#16 mediawiki\includes\MediaWiki.php(517): MediaWiki->main()
#17 mediawiki\index.php(43): MediaWiki->run()
#18 {main}

I was also presented with a message saying "Your password has been changed successfully!"
Clicking on my watch list then prompted me to login again
I could then log in with my new password and everything started behaving as expected.

Event Timeline

Addshore raised the priority of this task from to Needs Triage.
Addshore updated the task description. (Show Details)
Addshore subscribed.

The session ID gets reset during password change, apparently something went wrong with that and it tried to reuse the old session ID to create a new session. Since the report is very old, not worth looking into IMO - please reopen if it's still happening.

FWIW you can do something like

$wgHooks['isValidPassword'][] = function ( $password, &$result, $user ) {
    if ( $password === 'password' ) {
        $result = true;
    }
};

to avoid your local setup complaining about a weak password.