Page MenuHomePhabricator

unable to undelete a page in the MediaWiki namespace in some wiki (due to system user ID being 0 or negative?)
Closed, ResolvedPublicPRODUCTION ERROR

Description

While trying to figure out bug T171711, I deleted the page https://din.wikipedia.org/wiki/MediaWiki:Mobile-frontend-placeholder . Then I tried to use the undelete function to restore it, and got:

[WXnbrwpAIDMAAGS5FskAAACK] 2017-07-27 12:25:20: Fatal exception of type "UnexpectedValueException"

This definitely doesn't look right.

Event Timeline

Amire80 created this task.Jul 27 2017, 12:27 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJul 27 2017, 12:27 PM
Reedy added a subscriber: Reedy.
2017-07-27 12:25:20 [WXnbrwpAIDMAAGS5FskAAACK] mw1181 dinwiki 1.30.0-wmf.10 exception ERROR: [WXnbrwpAIDMAAGS5FskAAACK] /w/index.php?title=K%C3%ABc%C3%ABweek:Undelete&action=submit   UnexpectedValueException from line 170 of /srv/mediawiki/php-1.30.0-wmf.10/includes/user/UserGroupMembership.php: UserGroupMembership::insert() needs a positive user ID. Did you forget to add your User object to the database before calling addGroup()? {"exception_id":"WXnbrwpAIDMAAGS5FskAAACK","caught_by":"mwe_handler"}
[Exception UnexpectedValueException] (/srv/mediawiki/php-1.30.0-wmf.10/includes/user/UserGroupMembership.php:170) UserGroupMembership::insert() needs a positive user ID. Did you forget to add your User object to the database before calling addGroup()?
  #0 /srv/mediawiki/php-1.30.0-wmf.10/includes/user/User.php(3441): UserGroupMembership->insert(boolean)
  #1 /srv/mediawiki/php-1.30.0-wmf.10/extensions/Flow/includes/TalkpageManager.php(263): User->addGroup(string)
  #2 /srv/mediawiki/php-1.30.0-wmf.10/extensions/Flow/container.php(1274): Flow\TalkpageManager->getTalkpageManager()
  #3 /srv/mediawiki/php-1.30.0-wmf.10/vendor/pimple/pimple/src/Pimple/Container.php(113): Closure$#148(Flow\Container)
  #4 /srv/mediawiki/php-1.30.0-wmf.10/extensions/Flow/includes/Container.php(48): Pimple\Container->offsetGet(string)
  #5 /srv/mediawiki/php-1.30.0-wmf.10/extensions/Flow/Hooks.php(1652): Flow\Container::get(string)
  #6 /srv/mediawiki/php-1.30.0-wmf.10/includes/Hooks.php(186): FlowHooks::onArticleUndelete(Title, boolean, string, integer, array)
  #7 /srv/mediawiki/php-1.30.0-wmf.10/includes/page/PageArchive.php(766): Hooks::run(string, array)
  #8 /srv/mediawiki/php-1.30.0-wmf.10/includes/page/PageArchive.php(444): PageArchive->undeleteRevisions(array, boolean, string)
  #9 /srv/mediawiki/php-1.30.0-wmf.10/includes/specials/SpecialUndelete.php(1141): PageArchive->undelete(array, string, array, boolean, User)
  #10 /srv/mediawiki/php-1.30.0-wmf.10/includes/specials/SpecialUndelete.php(201): SpecialUndelete->undelete()
  #11 /srv/mediawiki/php-1.30.0-wmf.10/includes/specialpage/SpecialPage.php(522): SpecialUndelete->execute(NULL)
  #12 /srv/mediawiki/php-1.30.0-wmf.10/includes/specialpage/SpecialPageFactory.php(578): SpecialPage->run(NULL)
  #13 /srv/mediawiki/php-1.30.0-wmf.10/includes/MediaWiki.php(287): SpecialPageFactory::executePath(Title, RequestContext)
  #14 /srv/mediawiki/php-1.30.0-wmf.10/includes/MediaWiki.php(867): MediaWiki->performRequest()
  #15 /srv/mediawiki/php-1.30.0-wmf.10/includes/MediaWiki.php(523): MediaWiki->main()
  #16 /srv/mediawiki/php-1.30.0-wmf.10/index.php(43): MediaWiki->run()
  #17 /srv/mediawiki/w/index.php(3): include(string)
  #18 {main}

If the page was too old and created by Mediawiki default (or similar), it may be also related to T171315: Running update.php fails on old database which have edits by inexistent user "Mediawiki default"

What is"too old"? This wiki site was created this month :)

matmarex added a subscriber: matmarex.

Based on the backtrace, it looks like Flow's internal user account used to create Flow talk pages doesn't exist?

OK... it's curious that this happens on a page that is unrelated to Flow.

Catrope triaged this task as Unbreak Now! priority.Aug 1 2017, 5:50 PM
Restricted Application added subscribers: Liuxinyu970226, Jay8g, TerraCodes. · View Herald TranscriptAug 1 2017, 5:50 PM

Mysteriously, this works now. I just undeleted the page and it worked fine. I also looked at the return value of getTalkpageManager() in eval.php and it returned user ID 213 called Flow talk page manager. Maybe your request was the very first that created the talk page manager user, and this is something that fails only once per wiki?

Catrope lowered the priority of this task from Unbreak Now! to Medium.Aug 2 2017, 12:01 AM
Restricted Application added a project: Collaboration-Team-Triage. · View Herald TranscriptAug 2 2017, 12:06 AM

It looks like the system user, when created, has a user ID that is 0 or negative, but I can't reproduce that. I tried simulating this process by running $user = User::newSystemUser( 'Test system user', [ 'steal' => true ] ); $user->getGroups(); $user->addGroup( 'flow-bot' ); in eval.php both locally and on test2wiki, and I couldn't get it to fail.

Aklapper renamed this task from unable to undelete a page in the MediaWiki namespace in din.wikipedia.org to unable to undelete a page in the MediaWiki namespace in din.wikipedia.org (due to system user ID being 0 or negative?).Aug 3 2017, 10:16 AM
Jayprakash12345 raised the priority of this task from Medium to High.Sep 21 2017, 4:58 PM

What will happen next? because I am still unable to undelete on hiwikiversity. As I can see this is not a small problem.

Reedy added a comment.Sep 21 2017, 5:55 PM

I don't see one page as a big problem

Aklapper lowered the priority of this task from High to Medium.Sep 22 2017, 8:46 AM

@Jayprakash12345: As told before, please do not change the Priority field if you do not work on tasks.

Jayprakash12345 renamed this task from unable to undelete a page in the MediaWiki namespace in din.wikipedia.org (due to system user ID being 0 or negative?) to unable to undelete a page in the MediaWiki namespace in some wiki (due to system user ID being 0 or negative?).Oct 21 2017, 8:55 AM
Jayprakash12345 added subscribers: Benoit_Rochon, Amqui.
Krinkle closed this task as Resolved.Aug 14 2018, 3:03 AM
Krinkle added a subscriber: Krinkle.

Presumed resolved. No log entries for this in the last 7 days.

Restricted Application added a project: Growth-Team. · View Herald TranscriptAug 14 2018, 3:03 AM
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:10 PM