Page MenuHomePhabricator

OATHAuth's disableOATHAuthForUser.php script triggers a Notification that can't be sent as MW isn't initialised yet, so causes a production error
Closed, DuplicatePublicPRODUCTION ERROR

Description

Running the script works, but errors:

mwscript extensions/OATHAuth/maintenance/disableOATHAuthForUser.php --wiki=labswiki <x>
LogicException from line 408 of /srv/mediawiki/php-1.39.0-wmf.7/includes/cache/MessageCache.php: Process cache for 'en' should be set by now.
#0 /srv/mediawiki/php-1.39.0-wmf.7/includes/cache/MessageCache.php(1113): MessageCache->load('en')
#1 /srv/mediawiki/php-1.39.0-wmf.7/includes/cache/MessageCache.php(1041): MessageCache->getMsgFromNamespace('Emailsender', 'en')
#2 /srv/mediawiki/php-1.39.0-wmf.7/includes/cache/MessageCache.php(1011): MessageCache->getMessageForLang(Object(LanguageEn), 'emailsender', true, Array)
#3 /srv/mediawiki/php-1.39.0-wmf.7/includes/cache/MessageCache.php(953): MessageCache->getMessageFromFallbackChain(Object(LanguageEn), 'emailsender', true)
#4 /srv/mediawiki/php-1.39.0-wmf.7/includes/language/Message.php(1491): MessageCache->get('emailsender', true, Object(LanguageEn))
#5 /srv/mediawiki/php-1.39.0-wmf.7/includes/language/Message.php(968): Message->fetchMessage()
#6 /srv/mediawiki/php-1.39.0-wmf.7/includes/language/Message.php(1071): Message->format('text')
#7 /srv/mediawiki/php-1.39.0-wmf.7/extensions/Echo/includes/Notifier.php(94): Message->text()
#8 /srv/mediawiki/php-1.39.0-wmf.7/extensions/Echo/includes/controller/NotificationController.php(424): EchoNotifier::notifyWithEmail(Object(User), Object(EchoEvent))
#9 /srv/mediawiki/php-1.39.0-wmf.7/extensions/Echo/includes/controller/NotificationController.php(132): EchoNotificationController::doNotification(Object(EchoEvent), Object(User), 'email')
#10 /srv/mediawiki/php-1.39.0-wmf.7/extensions/Echo/includes/model/Event.php(195): EchoNotificationController::notify(Object(EchoEvent), false)
#11 /srv/mediawiki/php-1.39.0-wmf.7/extensions/OATHAuth/src/Notifications/Manager.php(56): EchoEvent::create(Array)
#12 /srv/mediawiki/php-1.39.0-wmf.7/extensions/OATHAuth/src/OATHUserRepository.php(182): MediaWiki\Extension\OATHAuth\Notifications\Manager::notifyDisabled(Object(MediaWiki\Extension\OATHAuth\OATHUser), false)
#13 /srv/mediawiki/php-1.39.0-wmf.7/extensions/OATHAuth/maintenance/disableOATHAuthForUser.php(37): MediaWiki\Extension\OATHAuth\OATHUserRepository->remove(Object(MediaWiki\Extension\OATHAuth\OATHUser), 'Maintenance scr...', false)
#14 /srv/mediawiki/php-1.39.0-wmf.7/maintenance/doMaintenance.php(114): DisableOATHAuthForUser->execute()
#15 /srv/mediawiki/php-1.39.0-wmf.7/extensions/OATHAuth/maintenance/disableOATHAuthForUser.php(48): require_once('/srv/mediawiki/...')
#16 /srv/mediawiki/multiversion/MWScript.php(116): require_once('/srv/mediawiki/...')
#17 {main}
jforrester@mwmaint1002:~$ mwscript extensions/OATHAuth/maintenance/disableOATHAuthForUser.php --wiki=labswiki <x>
User AAssaf doesn't have OATHAuth enabled!

Presumably the notifications / e-mails aren't sent?

Caused by T210075: Send notification when 2FA is disabled / T210963: Send an email when 2FA is disabled work, but I don't think it's serious enough to revert.

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald Transcript

Does the error also happen when the script is run from a labweb host?

Ref T237773#7841755 and (now written) wikitech:Maintenance server.

Does the error also happen when the script is run from a labweb host?

Ref T237773#7841755 and (now written) wikitech:Maintenance server.

Not sure; I was following the instructions which suggested it'd be fine from mwscript*. I don't hugely want to faff around resetting my 2FA status on a real account.

Does the error also happen when the script is run from a labweb host?

Ref T237773#7841755 and (now written) wikitech:Maintenance server.

Not sure; I was following the instructions which suggested it'd be fine from mwscript*. I don't hugely want to faff around resetting my 2FA status on a real account.

The instructions had an if/else branch, but the section for the disableOATHAuthForUser script specifically said "if wiktech then on a labsweb host or mwmaint1002". I've removed the "or" clause as this clearly doesn't work.

Does the error also happen when the script is run from a labweb host?

Ref T237773#7841755 and (now written) wikitech:Maintenance server.

Not sure; I was following the instructions which suggested it'd be fine from mwscript*. I don't hugely want to faff around resetting my 2FA status on a real account.

The instructions had an if/else branch, but the section for the disableOATHAuthForUser script specifically said "if wiktech then on a labsweb host or mwmaint1002". I've removed the "or" clause as this clearly doesn't work.

That's not true, it worked fine, it just emitted a fatal error as it happened because of a novel code path.

Tgr subscribed.

How can MediaWiki not be initialized by the time Maintenance::execute() is called? That sounds like some kind of serious Wikitech configuration bug.

In any case, not really related to Notifications.

I will hazard a guess that this was the same problem as T359823, triggered by Memcached being inaccessible (maybe it was a transient issue, or maybe it was misconfigured for Wikitech wiki in 2022).

I don't think anyone is going to look into this specific issue anyway, since it happened 3 years ago.

Restricted Application changed the subtype of this task from "Task" to "Production Error". · View Herald TranscriptMar 18 2025, 1:24 AM