Page MenuHomePhabricator

[BUG] GlobalPreferencesFactory emits "PHP Error: in_array() expects parameter 2 to be an array or collection"
Closed, ResolvedPublic3 Estimated Story PointsBUG REPORT

Description

Error

Request ID: W6FzwQrAIEMAACfCZpcAAAAM

message
[{exception_id}] {exception_url}   ErrorException from line 149 of /srv/mediawiki/php-1.32.0-wmf.20/extensions/GlobalPreferences/includes/GlobalPreferencesFactory.php:

PHP Warning: in_array() expects parameter 2 to be an array or collection
stacktrace
#1 /srv/mediawiki/php-1.32.0-wmf.20/extensions/GlobalPreferences/includes/GlobalPreferencesFactory.php(149): in_array(string, NULL)
#2 /srv/mediawiki/php-1.32.0-wmf.20/extensions/GlobalPreferences/includes/GlobalPreferencesFactory.php(119): GlobalPreferences\GlobalPreferencesFactory->getPreferencesLocal(array, NULL, RequestContext)
#3 /srv/mediawiki/php-1.32.0-wmf.20/includes/preferences/DefaultPreferencesFactory.php(1496): GlobalPreferences\GlobalPreferencesFactory->getFormDescriptor(User, RequestContext)
#4 /srv/mediawiki/php-1.32.0-wmf.20/includes/specials/SpecialPreferences.php(173): MediaWiki\Preferences\DefaultPreferencesFactory->getForm(User, RequestContext, string)
#5 /srv/mediawiki/php-1.32.0-wmf.20/includes/specials/SpecialPreferences.php(112): SpecialPreferences->getFormObject(User, RequestContext)
#6 /srv/mediawiki/php-1.32.0-wmf.20/includes/specialpage/SpecialPage.php(569): SpecialPreferences->execute(NULL)
#7 /srv/mediawiki/php-1.32.0-wmf.20/includes/specialpage/SpecialPageFactory.php(581): SpecialPage->run(NULL)
#8 /srv/mediawiki/php-1.32.0-wmf.20/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#9 /srv/mediawiki/php-1.32.0-wmf.20/includes/MediaWiki.php(868): MediaWiki->performRequest()
#10 /srv/mediawiki/php-1.32.0-wmf.20/includes/MediaWiki.php(525): MediaWiki->main()
#11 /srv/mediawiki/php-1.32.0-wmf.20/index.php(42): MediaWiki->run()

Notes

706 instances of this error were recorded in the last 30 days, including on 1.32.0-wmf.18 and 1.32.0-wmf.22. Appears to only happen on certain wikis, which suggests it might be related to extensions or configuration options of that wiki, or might require a certain action on the user's behalf before it "goes wrong".

he.wikipedia.org188x
ar.wikipedia.org186x
es.wikibooks.org168x
tw.wikipedia.org164x

Event Timeline

Restricted Application added a subscriber: Aklapper. ยท View Herald Transcript
Niharika renamed this task from GlobalPreferencesFactory emits "PHP Error: in_array() expects parameter 2 to be an array or collection" to [BUG] GlobalPreferencesFactory emits "PHP Error: in_array() expects parameter 2 to be an array or collection".Sep 19 2018, 2:59 PM
Niharika triaged this task as Medium priority.
Niharika moved this task from New & TBD Tickets to Needs Discussion on the Community-Tech board.

Change 462616 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/extensions/GlobalPreferences@master] Work around weird results returned from cache

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

Niharika added a subscriber: Niharika.

@MaxSem Can you put points on this? In general tickets it's ideal to put points on tickets before moving them to the sprint board.

MaxSem set the point value for this task to 3.Sep 25 2018, 10:00 PM

Change 462822 had a related patch set uploaded (by Krinkle; owner: MaxSem):
[mediawiki/extensions/GlobalPreferences@wmf/1.32.0-wmf.22] Work around weird results returned from cache

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

Change 462822 merged by jenkins-bot:
[mediawiki/extensions/GlobalPreferences@wmf/1.32.0-wmf.22] Work around weird results returned from cache

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

This is done, right? Looks like it was released on the last train.

Turns out I was wrong. Max said he has to revisit this as the original patch did not fix the problem.

Yep, still seen in prod on 1.32.0-wmf.24, 1.32.0-wmf.26.

Debug logging produced nothing, changing strategy.

Change 462616 abandoned by MaxSem:
Work around weird results returned from cache

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

Change 469792 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/extensions/GlobalPreferences@master] Add logging for T204781

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

Change 469793 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/extensions/GlobalPreferences@wmf/1.33.0-wmf.1] Add logging for T204781

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

Change 469793 merged by jenkins-bot:
[mediawiki/extensions/GlobalPreferences@wmf/1.33.0-wmf.1] Add logging for T204781

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

I've just noticed a lot of these in Fatal-Monitor, 212 in the last 15 minutes:

[{exception_id}] {exception_url} ErrorException from line 147 of /srv/mediawiki/php-1.33.0-wmf.9/extensions/GlobalPreferences/includes/GlobalPreferencesFactory.php: PHP Warning: in_array() expects parameter 2 to be an array or collection

Change 469792 merged by jenkins-bot:
[mediawiki/extensions/GlobalPreferences@master] Add logging for T204781

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

MaxSem moved this task from Q2 2018-19 to In Development on the Community-Tech-Sprint board.

That's only logging, we still don't know what exactly is gong on. On a side notice, we don't have a column for "blocked" where this ticket would suit best.

I apologize. I didn't look closely enough at the content of the patch.

That is a good point about a Blocked column. We do have a "Stalled" status which might work until we think more about a Blocked column.

Change 485371 had a related patch set uploaded (by Paladox; owner: MaxSem):
[mediawiki/extensions/GlobalPreferences@REL1_32] Add logging for T204781

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

Change 485371 merged by jenkins-bot:
[mediawiki/extensions/GlobalPreferences@REL1_32] Add logging for T204781

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

Received the first log entry, investigating.

Change 486200 had a related patch set uploaded (by MaxSem; owner: MaxSem):
[mediawiki/extensions/GlobalPreferences@master] Use MapCacheLRU::getWithSetCallback()

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

2 commits are ready for review. My findings are that for some reason, CentralIdLookup sometimes returns 0 for ID for users that are definitely global. I've no idea what's going on, but my patches make the logging more sensible, remove PHP errors when possible, and throw an exception when continuing is a really bad idea (shouldn't be possible because Special:GlobalPreferences already checks the global ID, but let's have another precaution).

Change 486200 merged by MaxSem:
[mediawiki/extensions/GlobalPreferences@master] Use MapCacheLRU::getWithSetCallback()

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

Change 486698 had a related patch set uploaded (by Paladox; owner: MaxSem):
[mediawiki/extensions/GlobalPreferences@REL1_32] Use MapCacheLRU::getWithSetCallback()

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

Change 486698 merged by jenkins-bot:
[mediawiki/extensions/GlobalPreferences@REL1_32] Use MapCacheLRU::getWithSetCallback()

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

@Samwilson suggested we can close this ticket. The underlying issue is not resolved, but the scope of this ticket is, and we can open a followup ticket for more work. :)

Yep, the last patch above made the error impossible. The underlying issue may still happen, but the software now expects and knows how to handle it.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:08 PM
Restricted Application changed the subtype of this task from "Production Error" to "Bug Report". ยท View Herald TranscriptAug 28 2019, 11:08 PM