Page MenuHomePhabricator

Login fails with cookies disabled error after CentralAuth update
Closed, ResolvedPublic

Description

I'm getting the following error repeatedly on the login form when attempting to login after updating to CentralAuth current master.

Login error
Testwiki uses cookies to log in users. You have cookies disabled. Please enable them and try again.

Event Timeline

FWIW, this issue is only present from 7fd01658b5be onwards and I also don't have a loginwiki-like setup locally.

Err, sorry. That is 700d46817974 not the one above.

I can't seem to reproduce this on my local system. Does clearing your cookies help?

Are you sure it starts happening after that specific patch? Can you check what goes to the 'session' log channel when you do a login attempt? Can you share your centralauth configuration?

I can't seem to reproduce this on my local system. Does clearing your cookies help?

Nope, errors present still.

Are you sure it starts happening after that specific patch?

Yep, just checked again. git bisect says it is indeed 700d46817974

Can you check what goes to the 'session' log channel when you do a login attempt?

1[session] CentralAuthSessionProvider::provideSessionInfo: Not enabled, falling back to core sessions
2[session] Session "mumcfmpbsmfikk0p6juqqpl3f5kffbg5" requested without UserID cookie
3[session] SessionBackend "mumcfmpbsmfikk0p6juqqpl3f5kffbg5" metadata dirty due to user change
4[session] SessionBackend "mumcfmpbsmfikk0p6juqqpl3f5kffbg5" save: dataDirty=0 metaDirty=1 forcePersist=0
5[session] SessionBackend "mumcfmpbsmfikk0p6juqqpl3f5kffbg5" data dirty due to addData(): MediaWiki\Session\SessionBackend->MediaWiki\Session\{closure}/MediaWiki\Session\SessionBackend->save/CentralAuthSessionProvider->persistSession/MediaWiki\Session\CookieSessionProvider->persistSession/MediaWiki\Session\SessionBackend->addData
6[session] SessionBackend "mumcfmpbsmfikk0p6juqqpl3f5kffbg5" data dirty due to addData(): MediaWiki\Session\SessionBackend->MediaWiki\Session\{closure}/MediaWiki\Session\SessionBackend->save/CentralAuthSessionProvider->persistSession/MediaWiki\Session\CookieSessionProvider->persistSession/MediaWiki\Session\SessionBackend->addData
7[session] Failed to create empty session: [Exception InvalidArgumentException( /var/www/html/wiki/includes/session/SessionManager.php:248) Session ID already exists]
8[session] CentralAuthSessionProvider::provideSessionInfo: Not enabled, falling back to core sessions
9[session] Session "mumcfmpbsmfikk0p6juqqpl3f5kffbg5" requested without UserID cookie
10[session] Session "[30]CentralAuthSessionProvider<anon>mumcfmpbsmfikk0p6juqqpl3f5kffbg5": User ID mismatch, 1 !== 0
11[session] SessionBackend "d3bucfcuo12ciptdcp9ostet4j8lds4s" is unsaved, marking dirty in constructor
12[session] SessionBackend "d3bucfcuo12ciptdcp9ostet4j8lds4s" save: dataDirty=1 metaDirty=1 forcePersist=0
13[session] Saving all sessions on shutdown
14[session] Failed to create empty session: [Exception InvalidArgumentException( /var/www/html/wiki/includes/session/SessionManager.php:248) Session ID already exists]
15[session] MediaWiki\Session\PHPSessionHandler::write: Session "mumcfmpbsmfikk0p6juqqpl3f5kffbg5" cannot be loaded, skipping write.
16[session] CentralAuthSessionProvider::provideSessionInfo: Not enabled, falling back to core sessions
17[session] SessionBackend "guj8p6m7hrrq5qui4qbqsls1lqri1p8c" is unsaved, marking dirty in constructor
18[session] SessionBackend "guj8p6m7hrrq5qui4qbqsls1lqri1p8c" save: dataDirty=1 metaDirty=1 forcePersist=0
19[session] SessionBackend "guj8p6m7hrrq5qui4qbqsls1lqri1p8c" force-persist due to persist()
20[session] SessionBackend "guj8p6m7hrrq5qui4qbqsls1lqri1p8c" save: dataDirty=0 metaDirty=1 forcePersist=1
21[session] SessionBackend "guj8p6m7hrrq5qui4qbqsls1lqri1p8c" Taking over PHP session
22[session] SessionBackend "guj8p6m7hrrq5qui4qbqsls1lqri1p8c" save: dataDirty=0 metaDirty=1 forcePersist=1
23[session] SessionBackend "guj8p6m7hrrq5qui4qbqsls1lqri1p8c" data dirty due to dirty(): LoginForm->mainLoginForm/LoginForm::getLoginToken/MediaWiki\Session\Session->getToken/MediaWiki\Session\Session->set/MediaWiki\Session\SessionBackend->dirty
24[session] Saving all sessions on shutdown
25[session] SessionBackend "guj8p6m7hrrq5qui4qbqsls1lqri1p8c" save: dataDirty=1 metaDirty=0 forcePersist=0
26[session] CentralAuthSessionProvider::provideSessionInfo: Not enabled, falling back to core sessions
27[session] Session "guj8p6m7hrrq5qui4qbqsls1lqri1p8c" requested without UserID cookie
28[session] CentralAuthSessionProvider::provideSessionInfo: Not enabled, falling back to core sessions
29[session] Session "guj8p6m7hrrq5qui4qbqsls1lqri1p8c" requested without UserID cookie
30[session] Saving all sessions on shutdown
31[session] Saving all sessions on shutdown

Can you share your centralauth configuration?

require_once "$IP/extensions/CentralAuth/CentralAuth.php";
$wgCentralAuthAutoNew = true;
$wgCentralAuthAutoMigrate = true;
$wgCentralAuthCreateOnView = true;
$wgCentralAuthSilentLogin = true;
$wgCentralAuthPreventUnattached = true;
$wgCentralAuthCookies = false;
$wgCentralAuthAutoMigrateNonGlobalAccounts = true;
$wgCentralAuthEnableGlobalRenameRequest = true;
$wgCentralAuthEnableUserMerge = true;

I just changed $wgCentralAuthCookies to true now and it now works. Please close this if my previous configuration was incorrect. Thanks.

I just changed $wgCentralAuthCookies to true now and it now works.

Excellent! I can reproduce it now by setting that to false.

Change 273581 had a related patch set uploaded (by Anomie):
Take $wgCentralAuthCookies into account when checking CentralAuthSource

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

Change 273581 merged by jenkins-bot:
Take $wgCentralAuthCookies into account when checking CentralAuthSource

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

Anomie claimed this task.