Page MenuHomePhabricator

PHP Notice: Trying to access array offset on value of type null
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   PHP Notice: Trying to access array offset on value of type null
FrameLocationCall
from/srv/mediawiki/php-1.44.0-wmf.14/extensions/EntitySchema/src/MediaWiki/Actions/ViewEntitySchemaAction.php(38)
#0/srv/mediawiki/php-1.44.0-wmf.14/extensions/EntitySchema/src/MediaWiki/Actions/ViewEntitySchemaAction.php(38)MWExceptionHandler::handleError(int, string, string, int, array)
#1/srv/mediawiki/php-1.44.0-wmf.14/includes/actions/ActionEntryPoint.php(732)EntitySchema\MediaWiki\Actions\ViewEntitySchemaAction->show()
#2/srv/mediawiki/php-1.44.0-wmf.14/includes/actions/ActionEntryPoint.php(509)MediaWiki\Actions\ActionEntryPoint->performAction(Article, MediaWiki\Title\Title)
#3/srv/mediawiki/php-1.44.0-wmf.14/includes/actions/ActionEntryPoint.php(145)MediaWiki\Actions\ActionEntryPoint->performRequest()
#4/srv/mediawiki/php-1.44.0-wmf.14/includes/MediaWikiEntryPoint.php(202)MediaWiki\Actions\ActionEntryPoint->execute()
#5/srv/mediawiki/php-1.44.0-wmf.14/index.php(58)MediaWiki\MediaWikiEntryPoint->run()
#6/srv/mediawiki/w/index.php(3)require(string)
#7{main}
Impact

Some logspam. Also the bad HTML <title> may or may not be related:

image.png (38×1 px, 7 KB)

Notes

Presumably related to our work on T228423: Labels for EntitySchemas do not use Language fallback.

Event Timeline

Oh, dammit, I bet I know what this is. We added a new property to the ParserOutput, but didn’t handle the case where the property is missing from old (cached) ParserOutput.

Honestly, I’m tempted to fix this by just purging all the EntitySchema pages, rather than fixing it in the code. There’s only 421 of them on Wikidata, that’s a manageable number.

I used the API sandbox to trigger a purge (with forcelinkupdate but without forcerecursivelinkupdate) for generator=allpages, gapnamespace=640 (EntitySchema), gaplimit=max (which should be enough to cover all existing pages without continuation). That seems to have fixed the bad title on E17.

Let’s check if any errors are still left in a few days (after the weekend ^^), and otherwise assume this is fixed and call it good enough.

(One of the reasons I’m not keen on fixing this in the code is that it’s not trivial – we would effectively have to actually load the EntitySchema in the view action, in order to access its label, when we’re supposed to just show the ParserOutput and not do any expensive / slow operations. I don’t think this complexity is worth it for an issue that goes away with a purge / cache expiry.)

(Also, just for search purposes, the user-visible impact of this task was that EntitySchemas would show the tab / window title like <span class="entityschema-title"><span class="entityschema-title-label">television series</span> <span class="entityschema-title-id">(E17)</span></span>.)

(Note: I haven’t yet purged any EntitySchema pages on Test Wikidata, just in case anyone wants to reproduce the issue there before the affected pages fall out of the parser cache. So it’s possible there will be some logstash occurrences on testwikidatawiki. If anyone is bothered by those, go ahead and do the purge I described above, IMHO.)

It’s still happening; the cases I see in logstash fall into three categories:

  1. diff URLs (example)
  2. invalid titles (example)
  3. Test Wikidata

3 is expected per T385272#10512265, but we need to fix 1 and 2.

1 turns out to be another issue that only happens with stale parser cache entries (I guess purging only clears the parser cache for the latest revision, but not older revisions). Fortunately, the fix for 2 covers 1 as well.

Change #1116820 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/EntitySchema@master] Avoid PHP Notice on missing entityschema-meta-tags

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

Change #1116820 merged by jenkins-bot:

[mediawiki/extensions/EntitySchema@master] Avoid PHP Notice on missing entityschema-meta-tags

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

Change #1117162 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/EntitySchema@wmf/1.44.0-wmf.15] Avoid PHP Notice on missing entityschema-meta-tags

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

Change #1117163 had a related patch set uploaded (by Lucas Werkmeister (WMDE); author: Lucas Werkmeister (WMDE)):

[mediawiki/extensions/EntitySchema@wmf/1.44.0-wmf.14] Avoid PHP Notice on missing entityschema-meta-tags

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

Change #1117163 merged by jenkins-bot:

[mediawiki/extensions/EntitySchema@wmf/1.44.0-wmf.14] Avoid PHP Notice on missing entityschema-meta-tags

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

Change #1117162 merged by jenkins-bot:

[mediawiki/extensions/EntitySchema@wmf/1.44.0-wmf.15] Avoid PHP Notice on missing entityschema-meta-tags

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

Mentioned in SAL (#wikimedia-operations) [2025-02-04T14:55:38Z] <lucaswerkmeister-wmde@deploy2002> Started scap sync-world: Backport for [[gerrit:1117163|Avoid PHP Notice on missing entityschema-meta-tags (T385272)]], [[gerrit:1117162|Avoid PHP Notice on missing entityschema-meta-tags (T385272)]]

Mentioned in SAL (#wikimedia-operations) [2025-02-04T14:59:02Z] <lucaswerkmeister-wmde@deploy2002> lucaswerkmeister-wmde: Backport for [[gerrit:1117163|Avoid PHP Notice on missing entityschema-meta-tags (T385272)]], [[gerrit:1117162|Avoid PHP Notice on missing entityschema-meta-tags (T385272)]] synced to the testservers (https://wikitech.wikimedia.org/wiki/Mwdebug)

Mentioned in SAL (#wikimedia-operations) [2025-02-04T15:06:35Z] <lucaswerkmeister-wmde@deploy2002> Finished scap sync-world: Backport for [[gerrit:1117163|Avoid PHP Notice on missing entityschema-meta-tags (T385272)]], [[gerrit:1117162|Avoid PHP Notice on missing entityschema-meta-tags (T385272)]] (duration: 10m 56s)