Page MenuHomePhabricator

Notice: Undefined index: sequenceId in php-1.27.0-wmf.10/extensions/ContentTranslation/includes/TranslationUnit.php on line 24
Closed, ResolvedPublicPRODUCTION ERROR

Description

ContentTranslation 1.27.0-wmf.10 has a bunch of notices:

Notice: Undefined index: sequenceId in /srv/mediawiki/php-1.27.0-wmf.10/extensions/ContentTranslation/includes/TranslationUnit.php on line 24

Event Timeline

hashar raised the priority of this task from to Needs Triage.
hashar updated the task description. (Show Details)
hashar added a subscriber: hashar.

Happens in php-1.27.0-wmf.12 as well.

santhosh added a project: LE-CX8-Sprint 2.
santhosh set Security to None.

Change 268632 had a related patch set uploaded (by Santhosh):
TransltionUnit: Check for sequenceId

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

There is also these errors (but somewhat less frequent)
Notice: Undefined index: content in /srv/mediawiki/php-1.27.0-wmf.12/extensions/ContentTranslation/includes/TranslationUnit.php on line 25
Notice: Cannot access property on non-object in /srv/mediawiki/php-1.27.0-wmf.12/extensions/ContentTranslation/api/ApiContentTranslationSave.php on line 44

The curious thing about the sequenceId is that it seems to appears in pairs of two (two events at identical timestamp). The notices about content sometimes appears as a third event at same timestamp.

The errors are coming from ApiContentTranslationSave. There is no other place where TranslationUnit objects are constructed where those fields could be missing.

The curious thing about the sequenceId is that it seems to appears in pairs of two (two events at identical timestamp).

They are source and translation.
The third one can be users translation or MT. But the error indicates that for some cxc_origin value( user, source, mt), sequenceId is not getting passed from client.

Example I was able to reproduce in my wiki (relatively old draft):

array(6) { ["content"]=> string(916) "An electronic cigarette with a USB-powered charger and wall changer.
The battery portion of the e-cigarette is disconnected and charged, as hsere through a USB-powered charger.s
" ["sectionId"]=> string(4) "mwBA" ["saved"]=> bool(false) ["sequenceId"]=> int(3) ["origin"]=> string(4) "user" ["translationId"]=> int(56) }

array(6) { ["content"]=> string(856) "An electronic cigarette with a USB-powered charger and wall changer.
The battery portion of the e-cigarette is disconnected and charged, as here through a USB-powered charger.
" ["sectionId"]=> string(4) "mwBA" ["saved"]=> bool(false) ["sequenceId"]=> int(3) ["origin"]=> string(6) "source" ["translationId"]=> int(56) }

array(6) { ["content"]=> string(1241) "Displaying a variety of e-cigarettes standing next to each other.
Various types of e-cigarettes.
" ["sectionId"]=> string(4) "mwCA" ["saved"]=> bool(false) ["sequenceId"]=> int(8) ["origin"]=> string(4) "user" ["translationId"]=> int(56) }

array(6) { ["content"]=> string(1183) "Displaying a variety of e-cigarettes standing next to each other.
Various types of e-cigarettes.
" ["sectionId"]=> string(4) "mwCA" ["saved"]=> bool(false) ["sequenceId"]=> int(8) ["origin"]=> string(6) "source" ["translationId"]=> int(56) }

array(6) { ["content"]=> string(12058) "Electronic cigarettes[note 1] are battery-powered vaporizers that simulate the feeling of smoking, but without tobacco.[1] Their use is commonly called "vaping".[2] The user activates the e-cigarette by taking a puff or pressing a button.[2][3] Some look like traditional cigarettes, but they come in many variations.[4][5] Mosst are reusable but there are also disposable versions called first generation cigalikes.[6] There are also second, third, and fourth generation devices.[7][8][9] Instead of cigarette smoke, the user inhales ana aerosol, commonly called vapor.[10] E-cigaresttes typically have a heating element that atomizes a liquid solution known as e-liquid.[11] E-liquids usually contain propylene glycol, glycerin, nicotine, and flavorings.[12][13][14][15]" ["sectionId"]=> string(4) "mwDA" ["saved"]=> bool(false) ["sequenceId"]=> int(13) ["origin"]=> string(4) "user" ["translationId"]=> int(56) }

array(6) { ["content"]=> string(6852) "Electronic cigarettes[note 1] are battery-powered vaporizers that simulate the feeling of smoking, but without tobacco.[1] Their use is commonly called "vaping".[2] Instead of cigarette smoke, the user inhales an aerosol, commonly called vapor,[3] typically released by a heating element that atomizes a liquid solution known as e-liquid.[4] The user activates the e-cigarette by taking a puff or pressing a button.[2][5] Some look like traditional cigarettes, but they come in many variations.[6][7] Most are reusable but there are also disposable versions called first-generation cigalikes;[8] there are also second, third, and fourth-generation devices.[9][10][11]" ["sectionId"]=> string(4) "mwDA" ["saved"]=> bool(false) ["sequenceId"]=> int(13) ["origin"]=> string(6) "source" ["translationId"]=> int(56) }

array(5) { ["content"]=> string(7483) "The benefits and the health risks of e-cigarettes are uncertain.[16][17][18] There is tentative evidence that they can help people quit smoking,[15] but they have not been proven better than regulated medication.[18] Their usefulness in tobacco harm reduction is unclear,[19] but they could form part of future strategies to decrease tobacco related death and disease.[13][20] Their safety risk to users is similar to that of smokeless tobacco.[20] Regulated nicotine replacement products are safer than e-cigarettes,[19] but e-cigarettes are probably safer than smoking.[21]" ["sectionId"]=> string(4) "mwHA" ["saved"]=> bool(false) ["origin"]=> string(4) "user" ["translationId"]=> int(56) }

array(5) { ["content"]=> string(37) "Expert Review of Respiratory Medicine" ["sectionId"]=> string(5) "mwAZA" ["saved"]=> bool(false) ["origin"]=> string(6) "source" ["translationId"]=> int(56) }

array(5) { ["content"]=> string(6) "e-cigs" ["sectionId"]=> string(5) "mwAYY" ["saved"]=> bool(false) ["origin"]=> string(6) "source" ["translationId"]=> int(56) }

array(5) { ["content"]=> string(16) "propylene glycol" ["sectionId"]=> string(4) "mwHA" ["saved"]=> bool(false) ["origin"]=> string(6) "source" ["translationId"]=> int(56) }

Thanks. I identify the following problems:

  1. What is saved as translation unit is not the sections HTML but sections internal HTML - Patch: https://gerrit.wikimedia.org/r/269908
  2. There is a section restore error in the above sample. section id mwHA has a saved section with origin=user - the paragraph starting with "the benefits and the health".. But, CX section restore algorithm fond the corresponding source section as "propylene glycol" which is an internal link with "mwHA" as Id. It is not a source section at all. This is a good input to improve our section restore algorithm. We should never match a non-block element as source section. Also, it turns out that links wont have seqId, causing subseqence save losing sequence Id.

So there are multiple issues to fix:

  1. Avoid the Undefined index: sequenceId issue at backend. Use a conditional access similar to what we did in https://gerrit.wikimedia.org/r/268632
  2. Further improvise our section restore algorithm - A big chunk of that is waiting review at https://gerrit.wikimedia.org/r/#/c/268645 but the above clue of target section id matching a non-section in source column is importnat to consider.

I improved https://gerrit.wikimedia.org/r/#/c/268645 so that the matches are done between sections and not between any element. Also the way we look for sections is from iterating source sections instead of iterating the target sections.

Change 268632 merged by jenkins-bot:
TranslationUnit: Check for sequenceId

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

Arrbee renamed this task from Notice: Undefined index: sequenceId in php-1.27.0-wmf.10/extensions/ContentTranslation/includes/TranslationUnit.php on line 24 to Notice: Undefined index: sequenceId in php-1.27.0-wmf.10/extensions/ContentTranslation/includes/TranslationUnit.php on line 24.Mar 4 2016, 6:48 AM
Arrbee closed this task as Resolved.
mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:11 PM