Page MenuHomePhabricator

Column 'cuc_actor' cannot be null (localhost) when logging in with incorrect creds
Closed, ResolvedPublicBUG REPORT

Description

List of steps to reproduce (step by step, including full links if applicable):

  • Go to /w/i.php?title=Special:UserLogin
  • Login to wiki with incorrect credentials

What happens?:
Following error appears (logs from my local machine):

[ed4e6ce52173539cbe6b38ce] /mediawiki/index.php?title=Special:UserLogin&returnto=Main+Page Wikimedia\Rdbms\DBQueryError: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading or after adding a new extension?

Please see https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:Upgrading and https://www.mediawiki.org/wiki/Special:MyLanguage/Manual:How_to_debug for more information.

Error 1048: Column 'cuc_actor' cannot be null (localhost)
Function: MediaWiki\CheckUser\Hooks::onAuthManagerLoginAuthenticateAudit
Query: INSERT INTO `cu_changes` (cuc_page_id,cuc_namespace,cuc_title,cuc_minor,cuc_user,cuc_user_text,cuc_actiontext,cuc_comment,cuc_this_oldid,cuc_last_oldid,cuc_type,cuc_timestamp,cuc_ip,cuc_ip_hex,cuc_xff,cuc_xff_hex,cuc_agent,cuc_actor) VALUES (0,2,'',0,0,'192.168.72.1','Failed to log in to DEV Wiki as [[User:Admin 12345|Admin 12345]]','',0,0,3,'20220413153031','192.168.72.1','C0A84801',0,NULL,'Mozilla/5.0 (X11; Linux x86_64; rv:99.0) Gecko/20100101 Firefox/99.0',NULL)

Backtrace:

from /home/abijeet/Projects/html/mediawiki/includes/libs/rdbms/database/Database.php(1606)
#0 /home/abijeet/Projects/html/mediawiki/includes/libs/rdbms/database/Database.php(1590): Wikimedia\Rdbms\Database->getQueryException()
#1 /home/abijeet/Projects/html/mediawiki/includes/libs/rdbms/database/Database.php(1564): Wikimedia\Rdbms\Database->getQueryExceptionAndLog()

What should have happened instead?:
Message stating that the credentials are incorrect.

Software version (if not a Wikimedia wiki), browser information, screenshots, other information, etc.:

  • MediaWiki master with CheckUser extension (master)
  • Set $wgCheckUserLogLogins = true;

Related Objects

View Standalone Graph
This task is connected to more than 200 other tasks. Only direct parents and subtasks are shown here. Use View Standalone Graph to show more of the graph.

Event Timeline

abi_ triaged this task as Unbreak Now! priority.Apr 13 2022, 3:51 PM

I think this is a UBN! since CheckUser extension is deployed on all Wikimedia wikis. Feel free to de-prioritize if this is not the case.

Debugging this issue a bit, the issue appears to be here:

Hooks.php
$dbw = $services->getDBLoadBalancer()->getConnectionRef( DB_PRIMARY );

if ( $ret->status === AuthenticationResponse::FAIL ) {
	$msg = 'checkuser-login-failure';
	$cuc_user = 0;
	$cuc_user_text = $ip;
	$cuc_actor = $services->getActorStore()->findActorIdByName( $ip, $dbw );
}

$services->getActorStore()->findActorIdByName( $ip, $dbw ); returns null for an unknown/invalid user.

@abi_: are you further on than this weeks train?

Looks like zabe is to blame, pinged him on IRC

@abi_: are you further on than this weeks train?

I think on Translatewiki we are. That is where I noticed this issue first, and then was able to reproduce locally.

But it appears as 1.39.0-wmf7 is already on group0 wikis so this issue should also be present there. Based on this patch - 779078: Start writing to cuc_actor in guwwiki and shnwikivoyage | https://gerrit.wikimedia.org/r/c/operations/mediawiki-config/+/779078 we should have this issue already, but I'm unable to reproduce this there.

Change 779906 had a related patch set uploaded (by Zabe; author: Zabe):

[operations/mediawiki-config@master] Revert "Start writing to cuc_actor in guwwiki and shnwikivoyage"

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

Change 779906 merged by jenkins-bot:

[operations/mediawiki-config@master] Revert "Start writing to cuc_actor in guwwiki and shnwikivoyage"

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

It does show up in wmf prod (request id c0d2e5d3-1777-4522-9258-d0e91a9be8d3).

[{reqId}] {exception_url}   Wikimedia\Rdbms\DBQueryError: Error 1048: Column 'cuc_actor' cannot be null (db1100)
Function: MediaWiki\CheckUser\Hooks::onAuthManagerLoginAuthenticateAudit
Query: INSERT INTO `cu_changes` (cuc_page_id,cuc_namespace,cuc_title,

from /srv/mediawiki/php-1.39.0-wmf.6/includes/libs/rdbms/database/Database.php(1614)
#0 /srv/mediawiki/php-1.39.0-wmf.6/includes/libs/rdbms/database/Database.php(1598): Wikimedia\Rdbms\Database->getQueryException(string, integer, string, string)
#1 /srv/mediawiki/php-1.39.0-wmf.6/includes/libs/rdbms/database/Database.php(1572): Wikimedia\Rdbms\Database->getQueryExceptionAndLog(string, integer, string, string)
#2 /srv/mediawiki/php-1.39.0-wmf.6/includes/libs/rdbms/database/Database.php(1162): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
#3 /srv/mediawiki/php-1.39.0-wmf.6/includes/libs/rdbms/database/Database.php(2360): Wikimedia\Rdbms\Database->query(string, string, integer)
#4 /srv/mediawiki/php-1.39.0-wmf.6/includes/libs/rdbms/database/Database.php(2340): Wikimedia\Rdbms\Database->doInsert(string, array, string)
#5 /srv/mediawiki/php-1.39.0-wmf.6/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->insert(string, array, string)
#6 /srv/mediawiki/php-1.39.0-wmf.6/includes/libs/rdbms/database/DBConnRef.php(335): Wikimedia\Rdbms\DBConnRef->__call(string, array)
#7 /srv/mediawiki/php-1.39.0-wmf.6/extensions/CheckUser/src/Hooks.php(506): Wikimedia\Rdbms\DBConnRef->insert(string, array, string)
#8 /srv/mediawiki/php-1.39.0-wmf.6/includes/HookContainer/HookContainer.php(338): MediaWiki\CheckUser\Hooks::onAuthManagerLoginAuthenticateAudit(MediaWiki\Auth\AuthenticationResponse, User, string, array)
#9 /srv/mediawiki/php-1.39.0-wmf.6/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook(string, array, array, array)
#10 /srv/mediawiki/php-1.39.0-wmf.6/includes/HookContainer/HookRunner.php(880): MediaWiki\HookContainer\HookContainer->run(string, array)
#11 /srv/mediawiki/php-1.39.0-wmf.6/includes/auth/AuthManager.php(550): MediaWiki\HookContainer\HookRunner->onAuthManagerLoginAuthenticateAudit(MediaWiki\Auth\AuthenticationResponse, NULL, string, array)
#12 /srv/mediawiki/php-1.39.0-wmf.6/includes/auth/AuthManager.php(456): MediaWiki\Auth\AuthManager->continueAuthentication(array)
#13 /srv/mediawiki/php-1.39.0-wmf.6/includes/specialpage/AuthManagerSpecialPage.php(372): MediaWiki\Auth\AuthManager->beginAuthentication(array, string)
#14 /srv/mediawiki/php-1.39.0-wmf.6/includes/specialpage/AuthManagerSpecialPage.php(502): AuthManagerSpecialPage->performAuthenticationStep(string, array)
#15 /srv/mediawiki/php-1.39.0-wmf.6/includes/htmlform/HTMLForm.php(726): AuthManagerSpecialPage->handleFormSubmit(array, VFormHTMLForm)
#16 /srv/mediawiki/php-1.39.0-wmf.6/includes/specialpage/AuthManagerSpecialPage.php(435): HTMLForm->trySubmit()
#17 /srv/mediawiki/php-1.39.0-wmf.6/includes/specialpage/LoginSignupSpecialPage.php(314): AuthManagerSpecialPage->trySubmit()
#18 /srv/mediawiki/php-1.39.0-wmf.6/includes/specialpage/SpecialPage.php(671): LoginSignupSpecialPage->execute(NULL)
#19 /srv/mediawiki/php-1.39.0-wmf.6/includes/specialpage/SpecialPageFactory.php(1382): SpecialPage->run(NULL)
#20 /srv/mediawiki/php-1.39.0-wmf.6/includes/MediaWiki.php(315): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#21 /srv/mediawiki/php-1.39.0-wmf.6/includes/MediaWiki.php(911): MediaWiki->performRequest()
#22 /srv/mediawiki/php-1.39.0-wmf.6/includes/MediaWiki.php(565): MediaWiki->main()
#23 /srv/mediawiki/php-1.39.0-wmf.6/index.php(50): MediaWiki->run()
#24 /srv/mediawiki/php-1.39.0-wmf.6/index.php(46): wfIndexMain()
#25 /srv/mediawiki/w/index.php(3): require(string)
#26 {main}

Mentioned in SAL (#wikimedia-operations) [2022-04-13T16:13:18Z] <reedy@deploy1002> Synchronized wmf-config/InitialiseSettings.php: T306045 (duration: 00m 55s)

Zabe lowered the priority of this task from Unbreak Now! to High.Apr 13 2022, 4:14 PM

The code is not new, so it is not a blocker.

Change 779912 had a related patch set uploaded (by Zabe; author: Zabe):

[mediawiki/extensions/CheckUser@master] Acquire fresh actor id for anons

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

Change 779912 merged by jenkins-bot:

[mediawiki/extensions/CheckUser@master] Acquire fresh actor id for anons

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

Should be fixed.