enterprisemediawiki / Wiretap

User pageview tracking for MediaWiki
4 stars 6 forks source link

Configuring $wgLBFactoryConf breaks Wiretap #30

Open calebgcooper opened 3 years ago

calebgcooper commented 3 years ago

I run a wikifarm and recently enabled TimedMediaHandler, this requires configuring $wgLBFactoryConf to share videos from a commons wiki.

I removed all extensions and ran a bare minimum wiki to validate the issue is specifically $wgLBFactoryConf config and Wiretap extension installed.

To reproduce install a new wiki (LAMP stack) with minimum config and add:

$wgLBFactoryConf = array(

'class' => 'LBFactoryMulti',

'sectionsByDB' => array(
    'commons' => 's1',
    $wgDBname => 's1',
),

'sectionLoads' => array(
    's1' => array(
        $wgDBserver  => 0, // All on section s1, which has single primary, at localhost.
    ),
),

'serverTemplate' => array(
    'dbname'      => $wgDBname,
    'user'          => $wgDBuser,
    'password'      => $wgDBpassword,
    'type'          => 'mysql',
    'flags'          => DBO_DEFAULT,
    'max lag'      => 30,
),
);

wfLoadExtension( 'Wiretap' );

$wgShowExceptionDetails = true;

This will result in the following backtrace:

Original exception: [2fe0a3c00589c7dfa95dd28c] /Main_Page Wikimedia\Rdbms\DBQueryError from line 1699 of /var/lib/mediawiki/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?

Error 1264: Out of range value for column 'response_time' at row 1 (wiki-mariadb)
Function: Wiretap::recordInDatabase
Query: INSERT INTO `wiretap` (page_id,page_name,user_name,hit_timestamp,hit_year,hit_month,hit_day,hit_hour,hit_weekday,page_action,oldid,diff,referer_url,referer_title,response_time) VALUES (1,'Main Page','172.17.0.1','20210507210518','2021','05','07','21','5',NULL,NULL,NULL,'https://stagingwiki1.devops.supportlabs.dell/Main_Page',0,'1620421518453')

Backtrace:
#0 /var/lib/mediawiki/includes/libs/rdbms/database/Database.php(1683): Wikimedia\Rdbms\Database->getQueryException()
#1 /var/lib/mediawiki/includes/libs/rdbms/database/Database.php(1658): Wikimedia\Rdbms\Database->getQueryExceptionAndLog()
#2 /var/lib/mediawiki/includes/libs/rdbms/database/Database.php(1227): Wikimedia\Rdbms\Database->reportQueryError()
#3 /var/lib/mediawiki/includes/libs/rdbms/database/Database.php(2343): Wikimedia\Rdbms\Database->query()
#4 /var/lib/mediawiki/includes/libs/rdbms/database/Database.php(2323): Wikimedia\Rdbms\Database->doInsert()
#5 /var/lib/mediawiki/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->insert()
#6 /var/lib/mediawiki/includes/libs/rdbms/database/DBConnRef.php(369): Wikimedia\Rdbms\DBConnRef->__call()
#7 /var/lib/mediawiki/extensions/Wiretap/Wiretap.body.php(63): Wikimedia\Rdbms\DBConnRef->insert()
#8 /var/lib/mediawiki/includes/HookContainer/HookContainer.php(321): Wiretap::recordInDatabase()
#9 /var/lib/mediawiki/includes/HookContainer/HookContainer.php(132): MediaWiki\HookContainer\HookContainer->callLegacyHook()
#10 /var/lib/mediawiki/includes/HookContainer/HookRunner.php(634): MediaWiki\HookContainer\HookContainer->run()
#11 /var/lib/mediawiki/includes/OutputPage.php(2631): MediaWiki\HookContainer\HookRunner->onAfterFinalPageOutput()
#12 /var/lib/mediawiki/includes/MediaWiki.php(947): OutputPage->output()
#13 /var/lib/mediawiki/includes/MediaWiki.php(960): MediaWiki->{closure}()
#14 /var/lib/mediawiki/includes/MediaWiki.php(543): MediaWiki->main()
#15 /var/lib/mediawiki/index.php(53): MediaWiki->run()
#16 /var/lib/mediawiki/index.php(46): wfIndexMain()
#17 {main}

Exception caught inside exception handler: [2fe0a3c00589c7dfa95dd28c] /Main_Page Wikimedia\Rdbms\DBQueryError from line 1699 of /var/lib/mediawiki/includes/libs/rdbms/database/Database.php: A database query error has occurred. Did you forget to run your application's database schema updater after upgrading?

Error 1264: Out of range value for column 'response_time' at row 1 (wiki-mariadb)
Function: Wiretap::recordInDatabase
Query: INSERT INTO `wiretap` (page_id,page_name,user_name,hit_timestamp,hit_year,hit_month,hit_day,hit_hour,hit_weekday,page_action,oldid,diff,referer_url,referer_title,response_time) VALUES (1,'Main Page','172.17.0.1','20210507210518','2021','05','07','21','5',NULL,NULL,NULL,'https://stagingwiki1.devops.supportlabs.dell/Main_Page',0,'1620421518475')

Backtrace:
#0 /var/lib/mediawiki/includes/libs/rdbms/database/Database.php(1683): Wikimedia\Rdbms\Database->getQueryException()
#1 /var/lib/mediawiki/includes/libs/rdbms/database/Database.php(1658): Wikimedia\Rdbms\Database->getQueryExceptionAndLog()
#2 /var/lib/mediawiki/includes/libs/rdbms/database/Database.php(1227): Wikimedia\Rdbms\Database->reportQueryError()
#3 /var/lib/mediawiki/includes/libs/rdbms/database/Database.php(2343): Wikimedia\Rdbms\Database->query()
#4 /var/lib/mediawiki/includes/libs/rdbms/database/Database.php(2323): Wikimedia\Rdbms\Database->doInsert()
#5 /var/lib/mediawiki/includes/libs/rdbms/database/DBConnRef.php(68): Wikimedia\Rdbms\Database->insert()
#6 /var/lib/mediawiki/includes/libs/rdbms/database/DBConnRef.php(369): Wikimedia\Rdbms\DBConnRef->__call()
#7 /var/lib/mediawiki/extensions/Wiretap/Wiretap.body.php(63): Wikimedia\Rdbms\DBConnRef->insert()
#8 /var/lib/mediawiki/includes/HookContainer/HookContainer.php(321): Wiretap::recordInDatabase()
#9 /var/lib/mediawiki/includes/HookContainer/HookContainer.php(132): MediaWiki\HookContainer\HookContainer->callLegacyHook()
#10 /var/lib/mediawiki/includes/HookContainer/HookRunner.php(634): MediaWiki\HookContainer\HookContainer->run()
#11 /var/lib/mediawiki/includes/OutputPage.php(2631): MediaWiki\HookContainer\HookRunner->onAfterFinalPageOutput()
#12 /var/lib/mediawiki/includes/exception/MWExceptionRenderer.php(153): OutputPage->output()
#13 /var/lib/mediawiki/includes/exception/MWExceptionRenderer.php(65): MWExceptionRenderer::reportHTML()
#14 /var/lib/mediawiki/includes/exception/MWExceptionHandler.php(106): MWExceptionRenderer::output()
#15 /var/lib/mediawiki/includes/exception/MWExceptionHandler.php(185): MWExceptionHandler::report()
#16 /var/lib/mediawiki/includes/MediaWiki.php(576): MWExceptionHandler::handleException()
#17 /var/lib/mediawiki/index.php(53): MediaWiki->run()
#18 /var/lib/mediawiki/index.php(46): wfIndexMain()
#19 {main}
calebgcooper commented 3 years ago

I should have said this is version 1.35.2:

image

calebgcooper commented 3 years ago

@jamesmontalvo3 I can confirm this issue is still present on the latest versions. Any chance you have time to take a look at this?