Page MenuHomeMiraheze

Hit Counters extension no longer working
Closed, DeclinedPublic

Description

The special page for the Hit Counters extension just loads forever before eventually showing "502 Bad Gateway."

Event Timeline

Unknown Object (User) added a comment.Jun 25 2022, 22:38

@Universal_Omega any ideas?

Assuming something to do with https://github.com/wikimedia/mediawiki-extensions-HitCounters/commit/f58214d, as that is the only change really made between 1.37 and 1.38.

Unknown Object (User) added a comment.Jun 29 2022, 17:44

The above commit was not at fault.
I also found that it also breaks Special:Statistics.

PHP slowlogs:

Special:Statistics
[29-Jun-2022 17:09:08]  [pool www] pid 326372
script_filename = /srv/mediawiki/w/index.php
[0x00007f7a39814600] query() /srv/mediawiki/w/includes/libs/rdbms/database/DatabaseMysqli.php:49
[0x00007f7a39814570] doQuery() /srv/mediawiki/w/includes/libs/rdbms/database/Database.php:1324
[0x00007f7a398143d0] executeQueryAttempt() /srv/mediawiki/w/includes/libs/rdbms/database/Database.php:1246
[0x00007f7a39814200] executeQuery() /srv/mediawiki/w/includes/libs/rdbms/database/Database.php:1169
[0x00007f7a39814110] query() /srv/mediawiki/w/includes/libs/rdbms/database/Database.php:1810
[0x00007f7a39813fe0] select() /srv/mediawiki/w/includes/libs/rdbms/database/DBConnRef.php:69
[0x00007f7a39813f10] __call() /srv/mediawiki/w/includes/libs/rdbms/database/DBConnRef.php:319
[0x00007f7a39813e50] select() /srv/mediawiki/w/extensions/HitCounters/includes/HitCounters.hooks.php:59
[0x00007f7a39813d40] getMostViewedPages() /srv/mediawiki/w/extensions/HitCounters/includes/HitCounters.hooks.php:47
[0x00007f7a39813c60] onSpecialStatsAddExtra() /srv/mediawiki/w/includes/HookContainer/HookContainer.php:338
[0x00007f7a39813b80] callLegacyHook() /srv/mediawiki/w/includes/HookContainer/HookContainer.php:137
[0x00007f7a39813a10] run() /srv/mediawiki/w/includes/HookContainer/HookRunner.php:3761
[0x00007f7a39813990] onSpecialStatsAddExtra() /srv/mediawiki/w/includes/specials/SpecialStatistics.php:67
[0x00007f7a39813650] execute() /srv/mediawiki/w/includes/specialpage/SpecialPage.php:671
[0x00007f7a398135d0] run() /srv/mediawiki/w/includes/specialpage/SpecialPageFactory.php:1378
[0x00007f7a39813480] executePath() /srv/mediawiki/w/includes/MediaWiki.php:315
[0x00007f7a39813300] performRequest() /srv/mediawiki/w/includes/MediaWiki.php:910
[0x00007f7a398131e0] main() /srv/mediawiki/w/includes/MediaWiki.php:564
[0x00007f7a39813130] run() /srv/mediawiki/w/index.php:53
[0x00007f7a39813090] wfIndexMain() /srv/mediawiki/w/index.php:46
Special:PopularPages
[29-Jun-2022 17:12:53]  [pool www] pid 328173
script_filename = /srv/mediawiki/w/index.php
[0x00007f7a398140f0] query() /srv/mediawiki/w/includes/libs/rdbms/database/DatabaseMysqli.php:49
[0x00007f7a39814060] doQuery() /srv/mediawiki/w/includes/libs/rdbms/database/Database.php:1324
[0x00007f7a39813ec0] executeQueryAttempt() /srv/mediawiki/w/includes/libs/rdbms/database/Database.php:1246
[0x00007f7a39813cf0] executeQuery() /srv/mediawiki/w/includes/libs/rdbms/database/Database.php:1169
[0x00007f7a39813c00] query() /srv/mediawiki/w/includes/libs/rdbms/database/Database.php:1810
[0x00007f7a39813ad0] select() /srv/mediawiki/w/includes/libs/rdbms/database/DBConnRef.php:69
[0x00007f7a39813a00] __call() /srv/mediawiki/w/includes/libs/rdbms/database/DBConnRef.php:319
[0x00007f7a39813940] select() /srv/mediawiki/w/includes/specialpage/QueryPage.php:523
[0x00007f7a398137f0] reallyDoQuery() /srv/mediawiki/w/includes/specialpage/QueryPage.php:703
[0x00007f7a39813650] execute() /srv/mediawiki/w/includes/specialpage/SpecialPage.php:671
[0x00007f7a398135d0] run() /srv/mediawiki/w/includes/specialpage/SpecialPageFactory.php:1378
[0x00007f7a39813480] executePath() /srv/mediawiki/w/includes/MediaWiki.php:315
[0x00007f7a39813300] performRequest() /srv/mediawiki/w/includes/MediaWiki.php:910
[0x00007f7a398131e0] main() /srv/mediawiki/w/includes/MediaWiki.php:564
[0x00007f7a39813130] run() /srv/mediawiki/w/index.php:53
[0x00007f7a39813090] wfIndexMain() /srv/mediawiki/w/index.php:46

If we can't find a solution I recommend removing the extension entirely.

Restricted Repository Identity mentioned this in R9:e27832fd2b54: T9442: disable HitCounters (#4870).
Unknown Object (User) added a comment.Aug 14 2022, 23:57

OK, I did some looking. This is caused by the fact that the extension has to sort fields, so for large wikis with 100,000 rows, sorting it, means it has to scan through all 100,000 rows, and return the last 10 because of ORDER BY page_counter LIMIT 10; this is horribly slow, and nothing I tried really improves it, I tried things like making it use indexes, and using GROUP BY. GROUP BY page_counter makes the page load, but in that case only one result is displayed, and it takes 45 seconds to load. Because of this, I recommend either removing the hit counters extension entirely, or severely limiting it to wikis of smaller size.

Unknown Object (User) closed this task as Declined.Sep 12 2022, 02:42
Unknown Object (User) claimed this task.

HitCounters has been completely disabled, due to issues with performance, and this issue, unless changes upstream are done, it likely wont be re-enabled. I apologise for the inconvenience, but at this time, nothing further can be done from our end.