Page MenuHomePhabricator

[TrustedXFF] on fresh install trusted-xff.cdb is missing and User::getDefaultOptions() cause a fatal
Closed, ResolvedPublic

Description

TrustedXFF installed via maintenance/install.php --with-extensions and upon hitting load.php:

PHP Warning:  fopen(cache/trusted-xff.cdb): failed to open stream: No such file or directory in vendor/wikimedia/cdb/src/Reader/PHP.php on line 72
PHP Fatal error:  Uncaught Error: Call to a member function getCode() on null in includes/user/User.php:1774
[proxy]: proxying request - /load.php?debug=false&lang=en&modules=jquery%2Cmediawiki%7Cmediawiki.base&only=scripts&skin=vector&version=0srjkld to 127.0.0.1:9412
[Mon Jun 25 16:35:48 2018] PHP Warning:  fopen(cache/trusted-xff.cdb): failed to open stream: No such file or directory in vendor/wikimedia/cdb/src/Reader/PHP.php on line 72
[Mon Jun 25 16:35:48 2018] PHP Fatal error:  Uncaught Error: Call to a member function getCode() on null in includes/user/User.php:1774
Stack trace:
#0 includes/user/User.php(5460): User::getDefaultOptions()
#1 includes/user/User.php(3144): User->loadOptions()
#2 includes/context/RequestContext.php(336): User->getOption('language')
#3 includes/Message.php(380): RequestContext->getLanguage()
#4 includes/Message.php(1296): Message->getLanguage()
#5 includes/Message.php(848): Message->fetchMessage()
#6 includes/Message.php(940): Message->toString('text')
#7 includes/exception/MWExceptionRenderer.php(201): Message->text()
#8 includes/exception/MWExceptionRenderer.php(140): MWExceptionRenderer::msg('internalerror', 'Internal error')
#9 includes/exception/MWExceptionRenderer.php(54): MWExceptionRenderer::reportHTML(Object(Cdb\Exception))
#10 includes/exception/MWExceptionHandler.php in includes/user/User.php on line 1774

Test change: https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/TrustedXFF/+/441907/

Event Timeline

Vvjjkkii renamed this task from [TrustedXFF] on fresh install trusted-xff.cdb is missing and User::getDefaultOptions() cause a fatal to zbaaaaaaaa.Jul 1 2018, 1:02 AM
Vvjjkkii triaged this task as High priority.
Vvjjkkii updated the task description. (Show Details)
Vvjjkkii removed a subscriber: Aklapper.
CommunityTechBot renamed this task from zbaaaaaaaa to [TrustedXFF] on fresh install trusted-xff.cdb is missing and User::getDefaultOptions() cause a fatal.Jul 2 2018, 10:02 AM
CommunityTechBot raised the priority of this task from High to Needs Triage.
CommunityTechBot updated the task description. (Show Details)
CommunityTechBot added a subscriber: Aklapper.

Change 444575 had a related patch set uploaded (by Hashar; owner: Hashar):
[mediawiki/extensions/TrustedXFF@master] Do not fail when trusted-xff.cdb does not exit

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

Looping Core Platform Team members.

TrustedXFF has a list of proxies as a text file, it has to be converted to a .cdb file for the extension to be functional. The cdb file is created by a generate script which is not run on MediaWiki install. That eventually causes pages to fail whenever trying to load an User object.

I have created a patch to throw an exception and catch it whenever the file is missing. That lets the extension work by default. https://gerrit.wikimedia.org/r/#/c/mediawiki/extensions/TrustedXFF/+/444575/

My use case is to migrate the CI jobs of TrustedXFF to Quibble which runs all test suites. QUnit / Selenium tests would choke due to the exception thrown due to a lack of CDB file. The above patch fix it :]

Change 444575 merged by jenkins-bot:
[mediawiki/extensions/TrustedXFF@master] Do not fail when trusted-xff.cdb does not exist

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

Change 653484 had a related patch set uploaded (by Legoktm; owner: Hashar):
[mediawiki/extensions/TrustedXFF@REL1_31] Do not fail when trusted-xff.cdb does not exist

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

Change 653484 merged by Legoktm:
[mediawiki/extensions/TrustedXFF@REL1_31] Do not fail when trusted-xff.cdb does not exist

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