Page MenuHomePhabricator

UserPageViewTracker: The unique key array should contain a single unique index
Closed, ResolvedPublicBUG REPORT

Description

I don't see anything in UserPageViewTracker's wiki page about bug reporting, so I'm reporting it here and assigning the extension author.

Steps to replicate the issue (include links if applicable):

  • Update MediaWiki to 1.39 from 1.35. I also updated PHP to 8.1, and updated the UserPageViewTracker extension to the release that supports 1.39. A clean install may also work, but I haven't tried this yet.
  • Log into your wiki with UserPageViewTracker. Anonymous users seem to be unaffected.
  • Visit the main page, or presumably any main namespace page.

What happens?:

MediaWiki internal error.

Original exception: [ZFKfvd9kU3LVv8EgWst-kgAAAAQ] /TualiPedia/index.php/TualiPedia:Community_Portal Wikimedia\Rdbms\DBLanguageError: The unique key array should contain a single unique index
Backtrace:
from /www/seidenphp/htdocs/TualiPedia/includes/libs/rdbms/platform/SQLPlatform.php(1889)
#0 /www/seidenphp/htdocs/TualiPedia/includes/libs/rdbms/platform/SQLPlatform.php(1834): Wikimedia\Rdbms\Platform\SQLPlatform->normalizeUpsertKeys()
#1 /www/seidenphp/htdocs/TualiPedia/includes/libs/rdbms/database/Database.php(1972): Wikimedia\Rdbms\Platform\SQLPlatform->normalizeUpsertParams()
#2 /www/seidenphp/htdocs/TualiPedia/includes/libs/rdbms/database/DBConnRef.php(103): Wikimedia\Rdbms\Database->upsert()
#3 /www/seidenphp/htdocs/TualiPedia/includes/libs/rdbms/database/DBConnRef.php(536): Wikimedia\Rdbms\DBConnRef->__call()
#4 /www/seidenphp/htdocs/TualiPedia/extensions/UserPageViewTracker/includes/specials/SpecialUserPageViewTracker.php(30): Wikimedia\Rdbms\DBConnRef->upsert()
#5 /www/seidenphp/htdocs/TualiPedia/includes/HookContainer/HookContainer.php(338): SpecialUserPageViewTracker::onBeforePageDisplay()
#6 /www/seidenphp/htdocs/TualiPedia/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook()
#7 /www/seidenphp/htdocs/TualiPedia/includes/HookContainer/HookRunner.php(945): MediaWiki\HookContainer\HookContainer->run()
#8 /www/seidenphp/htdocs/TualiPedia/includes/OutputPage.php(2871): MediaWiki\HookContainer\HookRunner->onBeforePageDisplay()
#9 /www/seidenphp/htdocs/TualiPedia/includes/MediaWiki.php(922): OutputPage->output()
#10 /www/seidenphp/htdocs/TualiPedia/includes/MediaWiki.php(562): MediaWiki->main()
#11 /www/seidenphp/htdocs/TualiPedia/index.php(50): MediaWiki->run()
#12 /www/seidenphp/htdocs/TualiPedia/index.php(46): wfIndexMain()
#13 {main}

Exception caught inside exception handler: [ZFKfvd9kU3LVv8EgWst-kgAAAAQ] /TualiPedia/index.php/TualiPedia:Community_Portal Wikimedia\Rdbms\DBLanguageError: The unique key array should contain a single unique index
Backtrace:
from /www/seidenphp/htdocs/TualiPedia/includes/libs/rdbms/platform/SQLPlatform.php(1889)
#0 /www/seidenphp/htdocs/TualiPedia/includes/libs/rdbms/platform/SQLPlatform.php(1834): Wikimedia\Rdbms\Platform\SQLPlatform->normalizeUpsertKeys()
#1 /www/seidenphp/htdocs/TualiPedia/includes/libs/rdbms/database/Database.php(1972): Wikimedia\Rdbms\Platform\SQLPlatform->normalizeUpsertParams()
#2 /www/seidenphp/htdocs/TualiPedia/includes/libs/rdbms/database/DBConnRef.php(103): Wikimedia\Rdbms\Database->upsert()
#3 /www/seidenphp/htdocs/TualiPedia/includes/libs/rdbms/database/DBConnRef.php(536): Wikimedia\Rdbms\DBConnRef->__call()
#4 /www/seidenphp/htdocs/TualiPedia/extensions/UserPageViewTracker/includes/specials/SpecialUserPageViewTracker.php(30): Wikimedia\Rdbms\DBConnRef->upsert()
#5 /www/seidenphp/htdocs/TualiPedia/includes/HookContainer/HookContainer.php(338): SpecialUserPageViewTracker::onBeforePageDisplay()
#6 /www/seidenphp/htdocs/TualiPedia/includes/HookContainer/HookContainer.php(137): MediaWiki\HookContainer\HookContainer->callLegacyHook()
#7 /www/seidenphp/htdocs/TualiPedia/includes/HookContainer/HookRunner.php(945): MediaWiki\HookContainer\HookContainer->run()
#8 /www/seidenphp/htdocs/TualiPedia/includes/OutputPage.php(2871): MediaWiki\HookContainer\HookRunner->onBeforePageDisplay()
#9 /www/seidenphp/htdocs/TualiPedia/includes/exception/MWExceptionRenderer.php(183): OutputPage->output()
#10 /www/seidenphp/htdocs/TualiPedia/includes/exception/MWExceptionRenderer.php(102): MWExceptionRenderer::reportHTML()
#11 /www/seidenphp/htdocs/TualiPedia/includes/exception/MWExceptionHandler.php(131): MWExceptionRenderer::output()
#12 /www/seidenphp/htdocs/TualiPedia/includes/exception/MWExceptionHandler.php(248): MWExceptionHandler::report()
#13 /www/seidenphp/htdocs/TualiPedia/includes/MediaWiki.php(581): MWExceptionHandler::handleException()
#14 /www/seidenphp/htdocs/TualiPedia/index.php(50): MediaWiki->run()
#15 /www/seidenphp/htdocs/TualiPedia/index.php(46): wfIndexMain()
#16 {main}

Disabling UserPageViewTracker works around this. This didn't occur with 1.35.x.

What should have happened instead?:

MediaWiki should display the page without errors.

Software version:

MediaWiki 1.39.3
PHP 8.1.18
MariaDB 10.3.32
ICU 69.1

Vector 1.0.0
UserPageViewTracker 0.6 (232b6ad)
VisualEditor 0.1.2
ParserFunctions 1.6.0
Widgets 1.4.2 (2cc2d3d)
HitCounter 0.3.4 (4a34afd)

Event Timeline

Hi! Thanks for the report, I was able to reproduce the issue and fixed it, see https://gerrit.wikimedia.org/r/c/mediawiki/extensions/UserPageViewTracker/+/920713

Please pull or download the latest version and feel free to reopen if anything is still wrong. Cheers!

Sophivorus claimed this task.