Page MenuHomePhabricator

Could not create UserTuple for workflow_user_
Closed, InvalidPublic

Description

The following error occurred on ee-flow, which is running b67dc7a.


An error has occurred.

Return to Main Page.

[b8e22f9c] /wiki/User_talk:Spage Exception from line 112 of /srv/mediawiki/extensions/Flow/includes/Model/Workflow.php: Could not create UserTuple for workflow_user_

Backtrace:

#0 [internal function]: Flow\Model\Workflow::fromStorageRow(array, NULL)
#1 /srv/mediawiki/extensions/Flow/includes/Data/Mapper/CachingObjectMapper.php(84): call_user_func(array, array, NULL)
#2 /srv/mediawiki/extensions/Flow/includes/Data/ObjectLocator.php(306): Flow\Data\Mapper\CachingObjectMapper->fromStorageRow(array)
#3 /srv/mediawiki/extensions/Flow/includes/Data/ObjectManager.php(127): Flow\Data\ObjectLocator->load(array)
#4 /srv/mediawiki/extensions/Flow/includes/Data/ObjectLocator.php(93): Flow\Data\ObjectManager->load(array)
#5 /srv/mediawiki/extensions/Flow/includes/Data/ObjectLocator.php(48): Flow\Data\ObjectLocator->findMulti(array, array)
#6 /srv/mediawiki/extensions/Flow/includes/WorkflowLoaderFactory.php(98): Flow\Data\ObjectLocator->find(array)
#7 /srv/mediawiki/extensions/Flow/includes/WorkflowLoaderFactory.php(74): Flow\WorkflowLoaderFactory->loadWorkflow(Title)
#8 /srv/mediawiki/extensions/Flow/includes/Actions/Action.php(75): Flow\WorkflowLoaderFactory->createWorkflowLoader(Title, NULL)
#9 /srv/mediawiki/extensions/Flow/includes/Actions/Action.php(33): Flow\Actions\FlowAction->showForAction(string)
#10 /srv/mediawiki/includes/MediaWiki.php(414): Flow\Actions\FlowAction->show()
#11 /srv/mediawiki/includes/MediaWiki.php(282): MediaWiki->performAction(Article, Title)
#12 /srv/mediawiki/includes/MediaWiki.php(584): MediaWiki->performRequest()
#13 /srv/mediawiki/includes/MediaWiki.php(435): MediaWiki->main()
#14 /srv/mediawiki/index.php(46): MediaWiki->run()
#15 {main}


Version: master
Severity: major

See Also T75153: Flow: Special:Contributions missing recent Flow content and T74280: Flow: 'Could not create UserTuple' silently aborts big chunk of Special:Contributions output

Details

Reference
bz71858

Event Timeline

bzimport raised the priority of this task from to High.Nov 22 2014, 3:58 AM
bzimport set Reference to bz71858.
bzimport added a subscriber: Unknown Object (MLST).

There is illegal state in the database:

select * from testwiki.flow_workflow where workflow_user_id = 0 and workflow_user_ip = '';

3 matching rows, including the one that causes this error.

Either user_id can be 0 or user_ip can be unset, but one has to be a valid value. Somehow this is/was not being enforced somewhere.

Erik suggested having UserTuple enforce a valid state. I think this can be done in the constructor. That will then hopefully reveal what is creating bogus UserTuples (since it will throw before it makes it to the database).

This may require changing IRCLineUrlFormatter to not construct mock workflows (the UserTuple logic can't be air-tight if there is an exception for this (as there currently is).

We also need to figure out what to do with the already-corrupt data on the test wiki. Simplest solution is probably to assign it to someone manually.

I think the same Could not create UserTuple' exception silently aborts the display of my recent http://ee-flow.wmflabs.org/wiki/Special:Contributions/Spage without any indication there's been a failure.

Can failure to load provide a dummy object so at least the rest of the page is visible?

gerritadmin wrote:

Change 171466 had a related patch set uploaded by EBernhardson:
Bug: prod db contains rows with both *_user_id and *_user_ip set

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

  • Bug 73153 has been marked as a duplicate of this bug. ***

Change 171466 merged by jenkins-bot:
Bug: prod db contains rows with both *_user_id and *_user_ip set

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

Spage lowered the priority of this task from High to Medium.Dec 24 2014, 12:15 AM

This is still happening in my local DB when I visit the Flow board Talk:Main_Page or the problem topic Topic:Rm0bhqmo6cweo5m8

The $row passed to Flow\Model\PostRevision::fromStorageRow() as $user contains

["tree_orig_user_id"]=>  string(1) "0"
["tree_parent_id"]=>  NULL
["tree_orig_user_ip"]=>  NULL
 ["tree_rev_descendant_id"]=> string(16) "rm0bhqmo6cweo5m8"

And my flow_tree_revision table does have three rows with tree_orig_user_id = 0 AND tree_orig_user_ip IS NULL.

maintenance/FlowSetUserIp.php should have fixed these rows, setting tree_orig_user_ip to tree_orig_user_text (now dropped). The script doesn't check if tree_orig_user_text is NULL, maybe that's how I got these three rows.

I ran:

UPDATE flow_tree_revision
   SET tree_orig_user_ip = '127.0.0.1' 
   WHERE tree_orig_user_id = 0 AND tree_orig_user_ip IS NULL;

and the exception isn't happening.

it might be worth querying beta and production databases to see if they have corrupt records, e.g. (untested):

SELECT * FROM flow_tree_revision
   WHERE (tree_orig_user_id = 0 OR tree_orig_user_id IS NULL)
        AND tree_orig_user_ip IS NULL;

I don't know if other tables might have similar empty user_ip - user_id tuples.