Page MenuHomePhabricator

mw.ext.data.get Lua call returns false
Closed, ResolvedPublic

Description

About 2 hours ago, problem start appearing in some articles at ruwiki.
It was reported at forum here. Example of affected article: Новограц, Жаклин.
At infobox Ошибка Lua в Модуль:Wikidata/Medals на строке 66: attempt to index upvalue 'awardsOrder' (a boolean value) error can be read.
Line # 66 of module accesses variable awardsOrder, which is initialized at line # 3:
local awardsOrder = mw.ext.data.get( "Wikidata/awards order.tab" )
When I try to check what value this variable have, I see result false.
It looks like mw.ext.data.get call should return something else.
To reproduce problem: open this link, paste mw.logObject(mw.ext.data.get("Wikidata/awards order.tab")) at debug console and press Enter.

I'm not sure if my report is correct, so close it if my description is wrong and problem is somewhere else.

Event Timeline

The actual data table is present. Was there any related code changes in MW?

This issue was also reported on the English Wikipedia.

Legoktm triaged this task as Unbreak Now! priority.Jan 19 2019, 4:38 AM
Legoktm added a project: JsonConfig.
legoktm@mwmaint1002:~$ mwscript eval.php --wiki=testwiki
> $titleStr='Wikidata/awards order.tab';

> $t=JsonConfig\JCSingleton::parseTitle( $titleStr, NS_DATA );

> var_dump($t);
object(JsonConfig\JCTitle)#459 (6) {
  ["config":"JsonConfig\JCTitle":private]=>
  object(stdClass)#450 (11) {
    ["namespace"]=>
    int(486)
    ["nsName"]=>
    string(4) "Data"
    ["pattern"]=>
    string(9) "/.\.tab$/"
    ["license"]=>
    string(7) "CC0-1.0"
    ["isLocal"]=>
    bool(false)
    ["remote"]=>
    object(stdClass)#451 (3) {
      ["url"]=>
      string(39) "https://commons.wikimedia.org/w/api.php"
      ["username"]=>
      string(0) ""
      ["password"]=>
      string(0) ""
    }
    ["model"]=>
    string(18) "Tabular.JsonConfig"
    ["cacheExp"]=>
    int(86400)
    ["cacheKey"]=>
    string(0) ""
    ["flaggedRevs"]=>
    bool(false)
    ["store"]=>
    bool(false)
  }
  ["namespace":protected]=>
  int(486)
  ["dbkey":protected]=>
  string(25) "Wikidata/awards_order.tab"
  ["fragment":protected]=>
  string(0) ""
  ["interwiki":protected]=>
  string(0) ""
  ["prefixedText"]=>
  NULL
}

> $c=JsonConfig\JCSingleton::getContentFromLocalCache($t);

> var_dump($c);
NULL

> $realC=JsonConfig\JCSingleton::getContent($t);

> var_dump($realC);
bool(false)

Next: why isn't JCSingleton::getContent() working?

Legoktm added a project: Regression.
Legoktm added a subscriber: Jdforrester-WMF.

7695dd8be7ecba2ef6c50adc6353d89f20e87c94 changed the API parameters but did not update the code handling the API response to update. I'll do a straight revert for now, and submit another patch to actually fix the issue.

Change 485360 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/extensions/JsonConfig@master] Revert "JCCache: Explicit load the main slot to avoid API warnings"

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

Change 485361 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/extensions/JsonConfig@wmf/1.33.0-wmf.13] Revert "JCCache: Explicit load the main slot to avoid API warnings"

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

Change 485362 had a related patch set uploaded (by Legoktm; owner: Legoktm):
[mediawiki/extensions/JsonConfig@master] Follow-up 7695dd8be7, fix API response handling

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

Change 485361 merged by jenkins-bot:
[mediawiki/extensions/JsonConfig@wmf/1.33.0-wmf.13] Revert "JCCache: Explicit load the main slot to avoid API warnings"

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

Mentioned in SAL (#wikimedia-operations) [2019-01-19T05:18:11Z] <legoktm@deploy1001> Synchronized php-1.33.0-wmf.13/extensions/JsonConfig/includes/JCCache.php: Revert "JCCache: Explicit load the main slot to avoid API warnings" - T214179 (duration: 00m 58s)

OK, should be fixed now. I tried out the reproduction in the description and it worked:

To reproduce problem: open this link, paste mw.logObject(mw.ext.data.get("Wikidata/awards order.tab")) at debug console and press Enter.

Can someone else confirm before I mark this as resolved?

Change 485360 merged by jenkins-bot:
[mediawiki/extensions/JsonConfig@master] Revert "JCCache: Explicit load the main slot to avoid API warnings"

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

This one is working again.

But does't work on ruwiki..

https://ru.wikipedia.org/w/api.php?action=scribunto-console&format=xml&title=%D0%9C%D0%BE%D0%B4%D1%83%D0%BB%D1%8C%3A123&question=mw.logObject(mw.ext.data.get(%27USGS_Earthquakes.tab%27))&clear=1 returns:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<api type="normal" print="nil " return="" session="753554712" sessionSize="53" sessionMaxSize="500000" sessionIsNew=""/>
proof: https://imgur.com/a/W9krdrd

But for some users it works fine:
proof: https://imgur.com/a/1agNwpS

seems something went wrong..
UPD: Server Cache and browser cache were purged also, no effect

I've deleted cookies and browser history (Chrome), it helps

After some minuts, it went wrong again

It looks like it depends whenever PHP7 setting is tuned on or off. When its off, problem disaperars, when its on, action=purge any article that uses it and you will get "false" when calling mw.ext.data.get()

@Ghuron, confirmed. When I've turned PHP7 off, the problem dissapeared

That's a separate issue then, so I've filed it as a separate task. Let's discuss it there: T215444: mw.ext.data.get from JsonConfig doesn't work with PHP 7.

Change 485362 merged by jenkins-bot:
[mediawiki/extensions/JsonConfig@master] Follow-up 7695dd8be7, fix API response handling

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