Page MenuHomePhabricator

PHP Notice: Undefined index: tp:tag
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   PHP Notice: Undefined index: tp:tag
exception.trace
from /srv/mediawiki/php-1.37.0-wmf.19/extensions/Translate/src/PageTranslation/PageTranslationSpecialPage.php(490)
#0 /srv/mediawiki/php-1.37.0-wmf.19/extensions/Translate/src/PageTranslation/PageTranslationSpecialPage.php(490): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.37.0-wmf.19/extensions/Translate/src/PageTranslation/PageTranslationSpecialPage.php(524): MediaWiki\Extension\Translate\PageTranslation\PageTranslationSpecialPage->classifyPages(array)
#2 /srv/mediawiki/php-1.37.0-wmf.19/extensions/Translate/src/PageTranslation/PageTranslationSpecialPage.php(110): MediaWiki\Extension\Translate\PageTranslation\PageTranslationSpecialPage->listPages()
#3 /srv/mediawiki/php-1.37.0-wmf.19/includes/specialpage/SpecialPage.php(646): MediaWiki\Extension\Translate\PageTranslation\PageTranslationSpecialPage->execute(NULL)
#4 /srv/mediawiki/php-1.37.0-wmf.19/includes/specialpage/SpecialPageFactory.php(1365): SpecialPage->run(NULL)
#5 /srv/mediawiki/php-1.37.0-wmf.19/includes/MediaWiki.php(314): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
#6 /srv/mediawiki/php-1.37.0-wmf.19/includes/MediaWiki.php(925): MediaWiki->performRequest()
#7 /srv/mediawiki/php-1.37.0-wmf.19/includes/MediaWiki.php(559): MediaWiki->main()
#8 /srv/mediawiki/php-1.37.0-wmf.19/index.php(53): MediaWiki->run()
#9 /srv/mediawiki/php-1.37.0-wmf.19/index.php(46): wfIndexMain()
#10 /srv/mediawiki/w/index.php(3): require(string)
#11 {main}
Notes

Started happening 2021/08/20. Low frequency but persistent.

User visible impact:

  • One translatable page on meta.wikipedia.org has slightly odd behavior (missing styles etc.)

Log notice happens when visiting Special:PageTranslation on meta (but no unexpected behavior there).

Outcome

It is no longer possible to mark a page without translatable content for translation. Doing that resulted in log spam and minor interface display glitch.

Details

Request URL
https://meta.wikimedia.org/wiki/Special:PageTranslation

Event Timeline

Assuming this task is about the MediaWiki-extensions-Translate code project, thus adding that project tag so other people can find this task. (PS: Using international date formats is welcome to avoid ambiguity.)

Nikerabbit added a subscriber: Nikerabbit.

It seems that this is caused by database "corruption" where a translatable page has tp:mark but not tp:tag. Logically this is impossible. I suggest degrading this from exception to an warning/error log message with additional details to aid debugging the root cause.

The page in question is Community_Wishlist_Survey/Updates.

(metawiki)> select * from revtag where revtag.rt_page = '11481900';
+---------+----------+-------------+----------+
| rt_type | rt_page  | rt_revision | rt_value |
+---------+----------+-------------+----------+
| tp:mark | 11481900 |    21913486 | NULL     |
+---------+----------+-------------+----------+

Logs: https://meta.wikimedia.org/w/index.php?title=Special:Log&page=Community+Wishlist+Survey%2FUpdates
History: https://meta.wikimedia.org/w/index.php?title=Community_Wishlist_Survey/Updates&action=history

Odd things noticed:
The versions @Tacsipacsi marked for translation does not have <translate> tags: https://meta.wikimedia.org/w/index.php?title=Community_Wishlist_Survey/Updates&oldid=21913486 and neither does the current version.

@Tacsipacsi Do you remember anything about this page?

I was able to reproduce the issue locally. Special:PageTranslation is missing a check that the current version has tp:tag.

I think the best way to fix the database is to use "remove from translation" option in https://meta.wikimedia.org/wiki/Special:PageTranslation for this page.

We will add checks to prevent this from happening again.

Change 714971 had a related patch set uploaded (by Nikerabbit; author: Nikerabbit):

[mediawiki/extensions/Translate@master] Special:PageTranslation: Require <translate> tags on the latest version for marking

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

Nikerabbit updated the task description. (Show Details)

Change 714971 merged by jenkins-bot:

[mediawiki/extensions/Translate@master] Special:PageTranslation: Require <translate> tags on the latest version for marking

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

Odd things noticed:
The versions @Tacsipacsi marked for translation does not have <translate> tags: https://meta.wikimedia.org/w/index.php?title=Community_Wishlist_Survey/Updates&oldid=21913486 and neither does the current version.

@Tacsipacsi Do you remember anything about this page?

Yes, this was intentional (a bit odd I admit, but since the software allowed it, I didn’t think it would cause a production error). Since the <languages/> bar was present in the first version, I thought the intention was to make it translatable, and I marked the page for translation to enable translation-aware transclusion, so that transclusions don’t show stray <translate> tags when translatable content is added. I was wrong, the text was added without translation markup, so it wouldn’t have broken even without translation-aware transclusion (even worse, thanks to this setup, the updates haven’t been visible when transcluded for four days, until I marked the page for translation again today), but I couldn’t see this in advance.

I noticed this started happening on se.wikimedia.org too, I left a message on their village pump to unmark the broken page there.

Should I be concerned about this causing further problems after rolling out wmf.21?

It looks like the fix is merged prior to the branch cut, so if I'm not mistaken, it's in wmf.21 and this isn't a blocker anymore.

Yes, it's in the wmf.21 branch and even if it wasn't, there is hardly any user visible impact.

Logstash looks good at the moment. Will look again on Monday and close if nothing unexpected shows up.