Page MenuHomePhabricator

Fatal "InvalidArgumentException: Blocker must be a local user" on Special:Contributions for blocked user
Closed, ResolvedPublicPRODUCTION ERROR

Description

Urls look like:

/w/index.php?title=Special:Contributions&contribs=user&target=*** where *** is an abusive username that was blocked.

Stacktrace:

2018-07-19 10:28:24 [W1BnyApAAEYAAD6E1UgAAADU] mw1275 metawiki 1.32.0-wmf.13 exception ERROR:
{
  exception_id: W1BnyApAAEYAAD6E1UgAAADU
  exception_url: "/w/index.php?limit=50&title=Special%3AContributions&contribs=user&target=***&namespace=&tagfilter=&start=&end=",
  "caught_by": mwe_handler
} 
[Exception InvalidArgumentException] (/srv/mediawiki/php-1.32.0-wmf.13/includes/Block.php:1514) Blocker must be a local user or a name that cannot be a local user
  #0 /srv/mediawiki/php-1.32.0-wmf.13/includes/Block.php(462): Block->setBlocker(User)
  #1 /srv/mediawiki/php-1.32.0-wmf.13/includes/Block.php(492): Block->initFromRow(stdClass)
  #2 /srv/mediawiki/php-1.32.0-wmf.13/includes/Block.php(362): Block::newFromRow(stdClass)
  #3 /srv/mediawiki/php-1.32.0-wmf.13/includes/Block.php(1195): Block->newLoad(NULL)
  #4 /srv/mediawiki/php-1.32.0-wmf.13/includes/user/User.php(1847): Block::newFromTarget(User, NULL, boolean)
  #5 /srv/mediawiki/php-1.32.0-wmf.13/includes/user/User.php(2274): User->getBlockedStatus(boolean)
  #6 /srv/mediawiki/php-1.32.0-wmf.13/includes/user/User.php(2264): User->getBlock(boolean)
  #7 /srv/mediawiki/php-1.32.0-wmf.13/includes/specials/SpecialContributions.php(376): User->isBlocked()
  #8 /srv/mediawiki/php-1.32.0-wmf.13/includes/specials/SpecialContributions.php(306): SpecialContributions::getUserLinks(SpecialContributions, User)
  #9 /srv/mediawiki/php-1.32.0-wmf.13/includes/specials/SpecialContributions.php(114): SpecialContributions->contributionsSub(User)
  #10 /srv/mediawiki/php-1.32.0-wmf.13/includes/specialpage/SpecialPage.php(566): SpecialContributions->execute(NULL)
  #11 /srv/mediawiki/php-1.32.0-wmf.13/includes/specialpage/SpecialPageFactory.php(569): SpecialPage->run(NULL)
  #12 /srv/mediawiki/php-1.32.0-wmf.13/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)
  #13 /srv/mediawiki/php-1.32.0-wmf.13/includes/MediaWiki.php(867): MediaWiki->performRequest()
  #14 /srv/mediawiki/php-1.32.0-wmf.13/includes/MediaWiki.php(524): MediaWiki->main()
  #15 /srv/mediawiki/php-1.32.0-wmf.13/index.php(42): MediaWiki->run()
  #16 /srv/mediawiki/w/index.php(3): include(string)
  #17 {main}

Explanation:
I was typing an username in Special:Contributions. A list of abusive usernames attacking that user also appear there so I wanted to know if those were handled properly. Selecting any of them resulted in the fatal I reported above.

Event Timeline

Vvjjkkii renamed this task from Fatal exception while querying an username to 7aeaaaaaaa.Jul 1 2018, 1:14 AM
Vvjjkkii raised the priority of this task from Medium to High.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed subscribers: Aklapper, MarcoAurelio.

@MarcoAurelio I'm unable to find this in the logs, I searched for the class name of the exception and anything with "Contributions". Can you still reproduce it? If so, please provide another exception ID so that I can re-query for details. In its current form, we cannot find or solve the problem.

(Tip: Be sure to use the share/short-url option next time, because the address bar is not shareable; the normal Logstash encoding is private to your session only.)

@Krinkle Actually the logstash link was shared to me by another developer. I do not have access to Logstash in production so I'm not able to provide you with another URL.

I'll try to remember which username it was and try to query it again.

@Krinkle: [W1BnyApAAEYAAD6E1UgAAADU] 2018-07-19 10:28:24: Fatal exception of type "InvalidArgumentException".

Thanks. It seems this one didn't make it to Logstash for some reason, but found it on mwlog1001 in archive/exception.log-20180720.gz.

2018-07-19 10:28:24 [W1BnyApAAEYAAD6E1UgAAADU] mw1275 metawiki 1.32.0-wmf.13 exception ERROR:
{
  exception_id: W1BnyApAAEYAAD6E1UgAAADU
  exception_url: "/w/index.php?limit=50&title=Special%3AContributions&contribs=user&target=***&namespace=&tagfilter=&start=&end=",
  "caught_by": mwe_handler
} 
[Exception InvalidArgumentException] (/srv/mediawiki/php-1.32.0-wmf.13/includes/Block.php:1514) Blocker must be a local user or a name that cannot be a local user
  #0 /srv/mediawiki/php-1.32.0-wmf.13/includes/Block.php(462): Block->setBlocker(User)
  #1 /srv/mediawiki/php-1.32.0-wmf.13/includes/Block.php(492): Block->initFromRow(stdClass)
  #2 /srv/mediawiki/php-1.32.0-wmf.13/includes/Block.php(362): Block::newFromRow(stdClass)
  #3 /srv/mediawiki/php-1.32.0-wmf.13/includes/Block.php(1195): Block->newLoad(NULL)
  #4 /srv/mediawiki/php-1.32.0-wmf.13/includes/user/User.php(1847): Block::newFromTarget(User, NULL, boolean)
  #5 /srv/mediawiki/php-1.32.0-wmf.13/includes/user/User.php(2274): User->getBlockedStatus(boolean)
  #6 /srv/mediawiki/php-1.32.0-wmf.13/includes/user/User.php(2264): User->getBlock(boolean)
  #7 /srv/mediawiki/php-1.32.0-wmf.13/includes/specials/SpecialContributions.php(376): User->isBlocked()
  #8 /srv/mediawiki/php-1.32.0-wmf.13/includes/specials/SpecialContributions.php(306): SpecialContributions::getUserLinks(SpecialContributions, User)
  #9 /srv/mediawiki/php-1.32.0-wmf.13/includes/specials/SpecialContributions.php(114): SpecialContributions->contributionsSub(User)
  #10 /srv/mediawiki/php-1.32.0-wmf.13/includes/specialpage/SpecialPage.php(566): SpecialContributions->execute(NULL)
  #11 /srv/mediawiki/php-1.32.0-wmf.13/includes/specialpage/SpecialPageFactory.php(569): SpecialPage->run(NULL)
  #12 /srv/mediawiki/php-1.32.0-wmf.13/includes/MediaWiki.php(288): SpecialPageFactory::executePath(Title, RequestContext)
  #13 /srv/mediawiki/php-1.32.0-wmf.13/includes/MediaWiki.php(867): MediaWiki->performRequest()
  #14 /srv/mediawiki/php-1.32.0-wmf.13/includes/MediaWiki.php(524): MediaWiki->main()
  #15 /srv/mediawiki/php-1.32.0-wmf.13/index.php(42): MediaWiki->run()
  #16 /srv/mediawiki/w/index.php(3): include(string)
  #17 {main}

@MarcoAurelio Given that you know the username that triggered it and (probably) how/why it was blocked, could you narrow down what circumstances cause this error? The internal error suggests that it may have something to do with global blocks or locks.

Krinkle renamed this task from Fatal exception while querying an username to Fatal exception on Special:Contributions for blocked user (InvalidArgumentException: "Blocker must be a local user or a name that cannot be a local user").Jul 24 2018, 3:01 PM
Krinkle raised the priority of this task from Medium to High.
Krinkle updated the task description. (Show Details)
Krinkle added a project: Contributors-Team.
Krinkle moved this task from Other to User blocking on the MediaWiki-User-management board.

Still seen on 1.32.0-wmf.26. Usually for simple user requests for urls like Special:Contributions/<some blocked username>.

The user names being intentionally hidden from public logs I won't post the url here, but to developers/managers: reach out privately for example that trigger this error. It typically looks like this:

Screen Shot 2018-10-24 at 11.05.22.png (652×1 px, 162 KB)

The exception is still present on 1.33.0-wmf.25 (rMWfca075095a20). I go the error when blocking a user from Special:Block.

This is an example of the issue on zhwp.

Screen Shot 2019-04-19 at 16.12.23.png (1×3 px, 960 KB)

It seems the data coming from the database and the blocker is already invalid on the database.

Maybe a maintenance script was blocking some users here?
Someone has to look at the ipblocks table for the row to see what is the blocker name, maybe refered by user id, user name or actor id.

kostajh subscribed.

Growth-Team was tagged in T192964#5110075 but unless I'm missing something we're not stewards for this section of code. I don't think we will be able to do anything around this in the short to medium term.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:09 PM

Change 559791 had a related patch set uploaded (by Tchanders; owner: Tchanders):
[mediawiki/core@master] Log some block details to debug DatabaseBlock::setBlocker

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

Change 559791 merged by jenkins-bot:
[mediawiki/core@master] block: Log some details to debug DatabaseBlock::setBlocker

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

Someone ever saw this in logstash? Alternatively, someone could send me (privately) the account name?

Krinkle renamed this task from Fatal exception on Special:Contributions for blocked user (InvalidArgumentException: "Blocker must be a local user or a name that cannot be a local user") to Fatal "InvalidArgumentException: Blocker must be a local user" on Special:Contributions for blocked user.Jan 13 2022, 6:41 PM
Krinkle closed this task as Resolved.

Not seen in WMF Logstash during last 90 days. There are quite a few log entries for a different instance of this mistake, but those originate from GlobalBlocking instead, filed at T298707.

Change 841481 had a related patch set uploaded (by Tchanders; author: Tchanders):

[mediawiki/core@master] Remove temporary logging for closed task from DatabaseBlock

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

Change 841481 merged by jenkins-bot:

[mediawiki/core@master] block: Remove temporary logging for closed task from DatabaseBlock

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