Page MenuHomePhabricator

Warning: Invalid parameter for message "abusefilter-log-detailedentry-local"
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

Request ID: W@JOmApAMEoAADKg6UsAAABS

message
Invalid parameter for message "abusefilter-log-detailedentry-local": a:1:{s:3:"num";N;
trace
#0 /srv/mediawiki/php-1.33.0-wmf.2/includes/Message.php(1142): Message->extractParam(string, string)
#1 /srv/mediawiki/php-1.33.0-wmf.2/includes/Message.php(874): Message->replaceParameters(string, string, string)
#2 /srv/mediawiki/php-1.33.0-wmf.2/includes/Message.php(980): Message->toString(string)
#3 /srv/mediawiki/php-1.33.0-wmf.2/extensions/AbuseFilter/includes/AbuseFilterModifyLogFormatter.php(40): Message->escaped()
#4 /srv/mediawiki/php-1.33.0-wmf.2/includes/logging/LogFormatter.php(550): AbuseFilterModifyLogFormatter->extractParameters()
#5 /srv/mediawiki/php-1.33.0-wmf.2/includes/logging/LogFormatter.php(464): LogFormatter->getMessageParameters()
#6 /srv/mediawiki/php-1.33.0-wmf.2/includes/logging/LogFormatter.php(439): LogFormatter->getActionMessage()
#7 /srv/mediawiki/php-1.33.0-wmf.2/includes/logging/LogEventsList.php(397): LogFormatter->getActionText()
#8 /srv/mediawiki/php-1.33.0-wmf.2/includes/logging/LogPager.php(389): LogEventsList->logLine(stdClass)
#9 /srv/mediawiki/php-1.33.0-wmf.2/includes/pager/IndexPager.php(446): LogPager->formatRow(stdClass)
#10 /srv/mediawiki/php-1.33.0-wmf.2/includes/specials/SpecialLog.php(248): IndexPager->getBody()
#11 /srv/mediawiki/php-1.33.0-wmf.2/includes/specials/SpecialLog.php(137): SpecialLog->show(FormOptions, array)
#12 /srv/mediawiki/php-1.33.0-wmf.2/includes/specialpage/SpecialPage.php(569): SpecialLog->execute(string)
#13 /srv/mediawiki/php-1.33.0-wmf.2/includes/specialpage/SpecialPageFactory.php(558): SpecialPage->run(string)
#14 /srv/mediawiki/php-1.33.0-wmf.2/includes/MediaWiki.php(288): MediaWiki\Special\SpecialPageFactory->executePath(Title, RequestContext)
#15 /srv/mediawiki/php-1.33.0-wmf.2/includes/MediaWiki.php(862): MediaWiki->performRequest()
#16 /srv/mediawiki/php-1.33.0-wmf.2/includes/MediaWiki.php(517): MediaWiki->main()
#17 /srv/mediawiki/php-1.33.0-wmf.2/index.php(42): MediaWiki->run()

Impact

Unknown.

Notes

Recorded 750 times in WMF Logstash in recent weeks (since at least 1.32-wmf.24, possibly earlier).

See also T93110 and T208537.

Can be reproduced at this page.

Event Timeline

If I understood T208537#4714444 correctly, this happens because we call numParams on null, which in turn means $filterId is null for the current entry. I have no idea about why this happens, though. Do we have some more context?

Now I have some context... Yes, this errors happen together with "undefined index 1" in AbuseFilterModifyLogFormatter.php at line 22, which means the filterID is missing. This produces a link to the correct filter (e.g. Special:AbuseFilter/xxx) but the message reads "[INVALID]".

Change 482864 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Emit a warning if log entry params are empty

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

Ah, now I got it. Quarry does show that log_params holds \n-imploded params... But it's the '\n' version, not the "\n" one, so those aren't linebreaks but actual backslashes followed by an 'n'. This explains why the explode cannot extract the parts etc.
As for the cause, I'm unsure. Apparently, there've been a period back in 2009 when we used to implode log_params with the bad '\n'. However, I couldn't find anything in AF code which used it: logging was first introduced with rEABFfe5141c412b1fbdeba1e597df620dac8225d999d on Mar 11th 2009, and then removed with rEABF1aa5ea69e8ed6d710b03bba8f58cdeb8d26bfc75 on Mar 18th. The implementation correctly used LogPage::addEntry, and nothing in LogPage or LogPager class seems to use implode with '\n'.
At any rate, this only happened for a short period of time, and we have two possible solutions: either add a special case explode with '\n' if filterID is null, or a maintenance script to update old entries in the DB. Given that I could only find broken entries for 'abusefilter' log, the former seems better. However, the second is safer and will avoid any possible future problem.

Change 482864 abandoned by Daimona Eaytoy:
Emit a warning if log entry params are empty

Reason:
T208931#4865248

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

Actually logging was introduced before (on January?), see here. Still, I couldn't find the reason. Maybe it's because in modifyActionText we did something wrong... Whatever, I'll just create a maintenance script.

Change 483101 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Add a maintenance script to fix broken log entries

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

Alroilim removed Daimona as the assignee of this task.
Alroilim triaged this task as Lowest priority.
Alroilim set Due Date to Feb 1 2019, 9:00 PM.
Alroilim updated the task description. (Show Details)
Alroilim removed subscribers: gerritbot, Daimona, Krinkle, Aklapper.
Restricted Application changed the subtype of this task from "Task" to "Deadline". · View Herald TranscriptFeb 2 2019, 7:21 PM
Gopavasanth assigned this task to Daimona.
Huji raised the priority of this task from Lowest to Needs Triage.Feb 2 2019, 8:04 PM
Huji removed Due Date.
Huji updated the task description. (Show Details)
Huji added subscribers: gerritbot, Krinkle, Aklapper.
Restricted Application changed the subtype of this task from "Deadline" to "Task". · View Herald TranscriptFeb 2 2019, 8:04 PM

Change 483101 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Add a maintenance script to fix broken log entries

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

Change 483101 merged by Daimona Eaytoy:
[mediawiki/extensions/AbuseFilter@master] Add a maintenance script to fix broken log entries

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

Change 524772 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Add fixOldLogEntries to update.php

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

Change 529608 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Fix addMissingLogEntriesScript

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

Change 529609 had a related patch set uploaded (by Daimona Eaytoy; owner: Daimona Eaytoy):
[mediawiki/extensions/AbuseFilter@master] Update fixOldLogEntries

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

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:08 PM

Change 529608 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Fix addMissingLogEntriesScript

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

Change 529609 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Update fixOldLogEntries

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

Krinkle changed the task status from Open to Stalled.Jan 29 2020, 3:55 PM

This is blocked on T228655.

Daimona changed the task status from Stalled to Open.Feb 28 2020, 11:56 AM

Almost resolved. The only thing left to do is add the script to the updater, https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/AbuseFilter/+/524772/

Change 524772 merged by jenkins-bot:
[mediawiki/extensions/AbuseFilter@master] Add fixOldLogEntries to update.php

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