Page MenuHomePhabricator

Database error on Flow history page
Closed, ResolvedPublic

Description

When I go to the history page of [[https://fr.wikipedia.org/wiki/Sujet:S2z3e3obn9pl32gg|this frwiki topic]], I get a “Database error”:

A database query error has occurred. This may indicate a bug in the software.

  • Function: Flow\Data\Storage\RevisionStorage::findInternal
  • Error: 1054 Unknown column 'topic_root_id' in 'where clause' (10.64.16.18)

Event Timeline

Ltrlg raised the priority of this task from to Needs Triage.
Ltrlg updated the task description. (Show Details)
Ltrlg added a project: StructuredDiscussions.
Ltrlg subscribed.
Ltrlg set Security to None.
EBernhardson triaged this task as Unbreak Now! priority.Mar 8 2015, 3:08 AM
2015-03-08 11:21:32 mw1251 frwiki: [90a477ec] /w/index.php?title=Sujet:S2z3e3obn9pl32gg&action=history   DBQueryError from line 1253 of /srv/mediawiki/php-1.25wmf19/includes/db/Database.php: A database error has occurred. Did you forget to run maintenance/update.php after upgrading?  See: https://www.mediawiki.org/wiki/Manual:Upgrading#Run_the_update_script
Query: SELECT  *  FROM `flow_tree_revision` JOIN `flow_revision` `rev` ON ((tree_rev_id = rev_id))  WHERE topic_root_id = '^E\"<AA><AE>Z(<F4><FE><C0><B8>0'  ORDER BY rev_id DESC LIMIT 501  
Function: Flow\Data\Storage\RevisionStorage::findInternal
Error: 1054 Unknown column 'topic_root_id' in 'where clause' (10.64.16.18)

#0 /srv/mediawiki/php-1.25wmf19/includes/db/Database.php(1209): DatabaseBase->reportQueryError()
#1 /srv/mediawiki/php-1.25wmf19/includes/db/Database.php(1733): DatabaseBase->query()
#2 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Data/Storage/RevisionStorage.php(142): DatabaseBase->select()
#3 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Data/Storage/RevisionStorage.php(182): Flow\Data\Storage\RevisionStorage->findInternal()
#4 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Data/Storage/RevisionStorage.php(163): Flow\Data\Storage\RevisionStorage->fallbackFindMulti()
#5 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Data/Storage/TopicHistoryStorage.php(43): Flow\Data\Storage\RevisionStorage->findMulti()
#6 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Data/ObjectLocator.php(83): Flow\Data\Storage\TopicHistoryStorage->findMulti()
#7 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Data/ObjectLocator.php(55): Flow\Data\ObjectLocator->findMulti()
#8 (): Flow\Data\ObjectLocator->find()
#9 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Data/ManagerGroup.php(129): call_user_func_array()
#10 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Data/ManagerGroup.php(141): Flow\Data\ManagerGroup->call()
#11 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Formatter/TopicHistoryQuery.php(30): Flow\Data\ManagerGroup->find()
#12 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Data/Pager/HistoryPager.php(50): Flow\Formatter\TopicHistoryQuery->getResults()
#13 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Block/Topic.php(698): Flow\Data\Pager\HistoryPager->doQuery()
#14 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Block/Topic.php(662): Flow\Block\TopicBlock->processHistoryResult()
#15 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Block/Topic.php(482): Flow\Block\TopicBlock->renderTopicHistoryApi()
#16 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/View.php(123): Flow\Block\TopicBlock->renderApi()
#17 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Actions/Action.php(103): Flow\View->show()
#18 /srv/mediawiki/php-1.25wmf19/extensions/Flow/includes/Actions/Action.php(44): Flow\Actions\FlowAction->showForAction()
#19 /srv/mediawiki/php-1.25wmf19/includes/MediaWiki.php(405): Flow\Actions\FlowAction->show()
#20 /srv/mediawiki/php-1.25wmf19/includes/MediaWiki.php(277): MediaWiki->performAction()
#21 /srv/mediawiki/php-1.25wmf19/includes/MediaWiki.php(571): MediaWiki->performRequest()
#22 /srv/mediawiki/php-1.25wmf19/includes/MediaWiki.php(424): MediaWiki->main()
#23 /srv/mediawiki/php-1.25wmf19/index.php(46): MediaWiki->run()
#24 /srv/mediawiki/w/index.php(3): include()
#25 {main}
EBernhardson lowered the priority of this task from Unbreak Now! to Medium.Mar 9 2015, 10:18 PM

I don't see any good reason for this error to have occurred, and its no longer occurring on the specified page. Somehow a NoIndexException was thrown, for now i've added some extra debugging which will log more info if this happens again.

Change 195461 had a related patch set uploaded (by EBernhardson):
Add some debugging info for NoIndexException with topic_root_id

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

Change 195461 merged by jenkins-bot:
Add some debugging info for NoIndexException with topic_root_id

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

matthiasmullie subscribed.

Error no longer occurs.
We've added better logging in case something similar happens again.
Fixed for now.

It still happens for me. I’ve tried other situations, but I was not able to reproduce unless I was logged in with my Ltrlg account. I’ve made a copy of my account preferences, reset it and reenabled one at a time. I found that having 500 as rclimit instead of the default 50 gives me the error.

This is still happening. I am not very active on Flow topics and I tested only one, but after I went to another topic history today, I tested and it appears to happen on all topic history when limit=500.

I noticed that this one (the one mentioned in T94813) does not look the same: the skin is displayed around the error message, which is translated.

Still happening for me and quite annoying since I read more Flow topics now and would prefer not to change my default limit. Have you got any new information in the log which may help?

Mattflaschen-WMF renamed this task from Database error in flow history page to Database error in flow history page with high limits.May 6 2015, 5:15 PM
Mattflaschen-WMF raised the priority of this task from Medium to Unbreak Now!.

This is reproducible for me, even not logged in (so no custom settings). I'm moving it into a sprint, as an Unbreak Now. Hopefully, the logging Erik added will help track this down.

Mattflaschen-WMF renamed this task from Database error in flow history page with high limits to Database error on Flow history page.May 6 2015, 10:13 PM

... Continuing T98127
Hello, @Mattflaschen, I checked what you asked. Here are the results in IE:

  1. Original link anonimously: works.
  2. Original link logged in: 500 HTTP error, not database error any more.
  3. New link: 500 either anonimously or logged in.

That's consistent with it being the limit. The database error is a 500. However, some browsers show the text we provide, while others provide generic text as IE apparently is.

Yes, we will. It's already our highest priority.

Change 210354 had a related patch set uploaded (by Matthias Mullie):
Fix TopicHistoryStorage, which is used when no cache applies

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

Change 210354 merged by jenkins-bot:
Fix TopicHistoryStorage, which is used when no cache applies

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

Could not verify it on beta due to Redis server error for Preference.

On https://fr.wikipedia.org/w/index.php?title=Sujet:S2z3e3obn9pl32gg&action=history the bug is reproducible; changed limit to 500 and got:
"A database query error has occurred. This may indicate a bug in the software.

Function: Flow\Data\Storage\RevisionStorage::findInternal
Error: 1054 Unknown column 'topic_root_id' in 'where clause' (10.64.16.18)"

Note: It could be useful to test DefaultSettings.php with different settings (incl 'rclimit' => 50). Checked in betalabs - no