Page MenuHomePhabricator

DB query error on api.php?action=translationstash
Closed, ResolvedPublic

Description

https://meta.wikimedia.org/w/api.php?action=translationstash&format=xml&subaction=query&title=Wikimedia%20Foundation%20Guiding%20Principles&token=NOTGIVINGIT

(which by the way I have no idea what does because it is not adequatedly documented, I was running it exactly to learn what it does)

returned me:

<?xml version="1.0"?>
<api servedby="mw1189">
  <error code="internal_api_error_DBQueryError" info="[WcbvHwpAIDsAAGki07QAAAAX] Database query error." />
</api>

Event Timeline

Base created this task.Sep 23 2017, 11:35 PM
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptSep 23 2017, 11:35 PM
Base updated the task description. (Show Details)Sep 23 2017, 11:36 PM

[Wcbv6ApAAE4AABWiJacAAAEE] Database query error.

Legoktm added a subscriber: Legoktm.
2017-09-23 23:32:47 [WcbvHwpAIDsAAGki07QAAAAX] mw1189 metawiki 1.30.0-wmf.19 exception ERROR: [WcbvHwpAIDsAAGki07QAAAAX] /w/api.php   Wikimedia\Rdbms\DBQueryError from line 1149 of /srv/mediawiki/php-1.30.0-wmf.19/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? 
Query: SELECT  ts_namespace,ts_title,ts_value,ts_metadata  FROM `translate_stash`    WHERE ts_user = '846960'  
Function: TranslationStashStorage::getTranslations
Error: 1146 Table 'metawiki.translate_stash' doesn't exist (10.64.48.15)
 {"exception_id":"WcbvHwpAIDsAAGki07QAAAAX","exception_url":"/w/api.php","caught_by":"mwe_handler"} 
[Exception Wikimedia\Rdbms\DBQueryError] (/srv/mediawiki/php-1.30.0-wmf.19/includes/libs/rdbms/database/Database.php:1149) A database query error has occurred. Did you forget to run your application's database schema updater after upgrading? 
Query: SELECT  ts_namespace,ts_title,ts_value,ts_metadata  FROM `translate_stash`    WHERE ts_user = '846960'  
Function: TranslationStashStorage::getTranslations
Error: 1146 Table 'metawiki.translate_stash' doesn't exist (10.64.48.15)

  #0 /srv/mediawiki/php-1.30.0-wmf.19/includes/libs/rdbms/database/Database.php(979): Wikimedia\Rdbms\Database->reportQueryError(string, integer, string, string, boolean)
  #1 /srv/mediawiki/php-1.30.0-wmf.19/includes/libs/rdbms/database/Database.php(1343): Wikimedia\Rdbms\Database->query(string, string)
  #2 /srv/mediawiki/php-1.30.0-wmf.19/extensions/Translate/stash/TranslationStashStorage.php(54): Wikimedia\Rdbms\Database->select(string, array, array, string)
  #3 /srv/mediawiki/php-1.30.0-wmf.19/extensions/Translate/api/ApiTranslationStash.php(73): TranslationStashStorage->getTranslations(User)
  #4 /srv/mediawiki/php-1.30.0-wmf.19/includes/api/ApiMain.php(1583): ApiTranslationStash->execute()
  #5 /srv/mediawiki/php-1.30.0-wmf.19/includes/api/ApiMain.php(546): ApiMain->executeAction()
  #6 /srv/mediawiki/php-1.30.0-wmf.19/includes/api/ApiMain.php(517): ApiMain->executeActionWithErrorHandling()
  #7 /srv/mediawiki/php-1.30.0-wmf.19/api.php(94): ApiMain->execute()
  #8 /srv/mediawiki/w/api.php(3): include(string)
  #9 {main}
Nikerabbit added a project: good first bug.
Nikerabbit added a subscriber: Nikerabbit.

Translator Sandbox is not enabled on any of the Wikimedia projects. The API module should not be registered or give a proper error message.

Restricted Application added a subscriber: TerraCodes. · View Herald TranscriptSep 24 2017, 9:11 AM

I doubt this can be good first bug, since the potetional resolution could affect changing tables in database

There is no need to change any tables. I already outlined two easy ways to fix this in my previous comment.

API modules can be registered conditionally using the ApiMain::moduleManager hook. So whatever setting controls the translator sandbox should be checked in that hook, and then it can register the module.

It seems the conditional registering is already in in TranslateHooks.php for the associated special page (Special:TranslationStash) using $wgSpecialPages['TranslationStash'] = 'SpecialTranslationStash';`.

The same could be done for the $wgAPIModules assignment.

Krinkle moved this task from Untriaged to Meta on the Wikimedia-production-error board.

Change 454826 had a related patch set uploaded (by Nikerabbit; owner: Nikerabbit):
[mediawiki/extensions/Translate@master] Conditionally register sandbox related API modules

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

Nikerabbit removed a project: Language-Team.

Change 454826 merged by jenkins-bot:
[mediawiki/extensions/Translate@master] Conditionally register sandbox related API modules

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

Krinkle closed this task as Resolved.Aug 23 2018, 8:44 PM
Krinkle removed a project: Patch-For-Review.