BadMethodCallException issue with TwoColConflict extension and BetaFeatures
Closed, ResolvedPublic

Description

[WdYHzQpAAD8AAEW@oSoAAACH] / BadMethodCallException from line 43 of /srv/mediawiki/php-1.31.0-wmf.2/extensions/BetaFeatures/includes/BetaFeaturesUtil.php: Call to a member function getOption() on a non-object (null)

Call to a member function getOption() on a non-object (null):
#0 /srv/mediawiki/php-1.31.0-wmf.2/extensions/TwoColConflict/includes/TwoColConflictHooks.php(124): BetaFeatures::isFeatureEnabled(NULL, string)
#1 /srv/mediawiki/php-1.31.0-wmf.2/includes/Hooks.php(177): TwoColConflictHooks::onSpecialPage_initList(array)

Spotted on hi.wikiversity:

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 5 2017, 10:24 AM
Jayprakash12345 triaged this task as Unbreak Now! priority.Oct 5 2017, 10:24 AM
Restricted Application added subscribers: Liuxinyu970226, Jay8g, TerraCodes. · View Herald TranscriptOct 5 2017, 10:24 AM
MarcoAurelio renamed this task from hiwikiversity has been crashed to hiwikiversity has crashed.Oct 5 2017, 10:25 AM
Restricted Application added a subscriber: Dereckson. · View Herald TranscriptOct 5 2017, 10:25 AM
Jayprakash12345 lowered the priority of this task from Unbreak Now! to Needs Triage.EditedOct 5 2017, 10:25 AM

Now It is working.

It's working fine for me. What do you exactly tried to do?

When I made https://hi.wikiversity.org/wiki/User:Jayprakash12345/common.js and test. The gadget is working fine. after the 3-4 minutes. I refresh the main page of the local wiki. then This error occurred.

@Jayprakash12345 When you've an error code, it means an error is in the logs at this code.

It would be convenient to have it in TEXT format instead of a screenshot, so we can actually find it in the logs.

Here प्रकार की गंभीर अपवाद means Fatal exception of type

Dereckson triaged this task as High priority.Oct 5 2017, 10:41 AM

The ID before, something like WdYHeQqAMFYAAlzpBicAAABI.

Meanwhile, I checked a little bit what we've in recent logs as fatal errors served on this wiki:

BadMethodCallException issue with TwoColConflict extension and BetaFeatures

[WdYHzQpAAD8AAEW@oSoAAACH] / BadMethodCallException from line 43 of /srv/mediawiki/php-1.31.0-wmf.2/extensions/BetaFeatures/includes/BetaFeaturesUtil.php: Call to a member function getOption() on a non-object (null)

Call to a member function getOption() on a non-object (null):
#0 /srv/mediawiki/php-1.31.0-wmf.2/extensions/TwoColConflict/includes/TwoColConflictHooks.php(124): BetaFeatures::isFeatureEnabled(NULL, string)
#1 /srv/mediawiki/php-1.31.0-wmf.2/includes/Hooks.php(177): TwoColConflictHooks::onSpecialPage_initList(array)

Dereckson renamed this task from hiwikiversity has crashed to BadMethodCallException issue with TwoColConflict extension and BetaFeatures.Oct 5 2017, 10:42 AM
Dereckson updated the task description. (Show Details)
Restricted Application added a project: TCB-Team. · View Herald TranscriptOct 5 2017, 10:42 AM
This comment was removed by MarcoAurelio.

Pretend you saw nothing :D

Dereckson added a comment.EditedOct 5 2017, 10:44 AM

So the error is $editPage->getContext()->getUser() or $this->specialPage->getUser() can return NULL, a case not handled by the extension.

Addshore claimed this task.Oct 5 2017, 10:45 AM
Addshore added a subscriber: Addshore.
Restricted Application added a project: User-Addshore. · View Herald TranscriptOct 5 2017, 10:45 AM
Addshore lowered the priority of this task from High to Normal.Oct 5 2017, 10:46 AM

Change is already reverted, but this is still currently on master of the TwoColConflict extension so leaving this open.

So the error is $editPage->getContext()->getUser() or $this->specialPage->getUser() can return NULL, a case not handled by the extension.

This is not the correct user check.

https://github.com/wikimedia/mediawiki-extensions-TwoColConflict/blob/c88d2d6a41c71783a985519719f0baec753e1c3d/includes/TwoColConflictHooks.php#L124

2017-10-05 10:22:05 [WdYHzQpAAD8AAEW@oSoAAACH] mw1268 hiwikiversity 1.31.0-wmf.2 exception ERROR: [WdYHzQpAAD8AAEW@oSoAAACH] /   BadMethodCallException from line 43 of /srv/mediawiki/php-1.31.0-wmf.2/extensions/BetaFeatures/includes/BetaFeaturesUtil.php: Call to a member function getOption() on a non-object (null) {"exception_id":"WdYHzQpAAD8AAEW@oSoAAACH","exception_url":"/","caught_by":"mwe_handler"}
[Exception BadMethodCallException] (/srv/mediawiki/php-1.31.0-wmf.2/extensions/BetaFeatures/includes/BetaFeaturesUtil.php:43) Call to a member function getOption() on a non-object (null)
  #0 /srv/mediawiki/php-1.31.0-wmf.2/extensions/TwoColConflict/includes/TwoColConflictHooks.php(124): BetaFeatures::isFeatureEnabled(NULL, string)
  #1 /srv/mediawiki/php-1.31.0-wmf.2/includes/Hooks.php(177): TwoColConflictHooks::onSpecialPage_initList(array)
  #2 /srv/mediawiki/php-1.31.0-wmf.2/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
  #3 /srv/mediawiki/php-1.31.0-wmf.2/includes/specialpage/SpecialPageFactory.php(268): Hooks::run(string, array)
  #4 /srv/mediawiki/php-1.31.0-wmf.2/includes/specialpage/SpecialPageFactory.php(285): SpecialPageFactory::getPageList()
  #5 /srv/mediawiki/php-1.31.0-wmf.2/includes/specialpage/SpecialPageFactory.php(660): SpecialPageFactory::getAliasList()
  #6 /srv/mediawiki/php-1.31.0-wmf.2/includes/specialpage/SpecialPage.php(98): SpecialPageFactory::getLocalNameFor(string, string)
  #7 /srv/mediawiki/php-1.31.0-wmf.2/includes/specialpage/SpecialPage.php(85): SpecialPage::getTitleValueFor(string, string, string)
  #8 /srv/mediawiki/php-1.31.0-wmf.2/extensions/ShortUrl/ShortUrl.hooks.php(23): SpecialPage::getTitleFor(string, string)
  #9 /srv/mediawiki/php-1.31.0-wmf.2/includes/Hooks.php(177): ShortUrlHooks::setupUrlRouting(PathRouter)
  #10 /srv/mediawiki/php-1.31.0-wmf.2/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
  #11 /srv/mediawiki/php-1.31.0-wmf.2/includes/WebRequest.php(171): Hooks::run(string, array)
  #12 /srv/mediawiki/php-1.31.0-wmf.2/includes/WebRequest.php(316): WebRequest::getPathInfo(string)
  #13 /srv/mediawiki/php-1.31.0-wmf.2/includes/Setup.php(721): WebRequest->interpolateTitle()
  #14 /srv/mediawiki/php-1.31.0-wmf.2/includes/WebStart.php(114): include(string)
  #15 /srv/mediawiki/php-1.31.0-wmf.2/index.php(40): include(string)
  #16 /srv/mediawiki/w/index.php(3): include(string)
  #17 {main}

There was also a spike in:

[{exception_id}] {exception_url} BadMethodCallException from line 847 of /srv/mediawiki/php-1.31.0-wmf.2/includes/session/SessionManager.php: Sessions are disabled for this entry point
2017-10-05 10:19:43 [WdYHPwpAEK8AAE9BNLsAAAAU] mw1220 scnwiktionary 1.31.0-wmf.2 exception ERROR: [WdYHPwpAEK8AAE9BNLsAAAAU] /w/load.php?debug=false&lang=scn&modules=startup&only=scripts&skin=vector   BadMethodCallException from line 847 of /srv/mediawiki/php-1.31.0-wmf.2/includes/session/SessionManager.php: Sessions are disabled for this entry point {"exception_id":"WdYHPwpAEK8AAE9BNLsAAAAU","exception_url":"/w/load.php?debug=false&lang=scn&modules=startup&only=scripts&skin=vector","caught_by":"other"}
[Exception BadMethodCallException] (/srv/mediawiki/php-1.31.0-wmf.2/includes/session/SessionManager.php:847) Sessions are disabled for this entry point
  #0 /srv/mediawiki/php-1.31.0-wmf.2/includes/session/SessionManager.php(309): MediaWiki\Session\SessionManager->getSessionFromInfo(MediaWiki\Session\SessionInfo, WebRequest)
  #1 /srv/mediawiki/php-1.31.0-wmf.2/includes/session/SessionManager.php(243): MediaWiki\Session\SessionManager->getEmptySessionInternal(WebRequest)
  #2 /srv/mediawiki/php-1.31.0-wmf.2/includes/session/SessionManager.php(193): MediaWiki\Session\SessionManager->getEmptySession(WebRequest)
  #3 /srv/mediawiki/php-1.31.0-wmf.2/includes/WebRequest.php(735): MediaWiki\Session\SessionManager->getSessionForRequest(WebRequest)
  #4 /srv/mediawiki/php-1.31.0-wmf.2/includes/user/User.php(1231): WebRequest->getSession()
  #5 /srv/mediawiki/php-1.31.0-wmf.2/includes/user/User.php(408): User->loadFromSession()
  #6 /srv/mediawiki/php-1.31.0-wmf.2/includes/user/User.php(5269): User->load()
  #7 /srv/mediawiki/php-1.31.0-wmf.2/includes/user/User.php(2887): User->loadOptions()
  #8 /srv/mediawiki/php-1.31.0-wmf.2/extensions/BetaFeatures/includes/BetaFeaturesUtil.php(43): User->getOption(string)
  #9 /srv/mediawiki/php-1.31.0-wmf.2/extensions/TwoColConflict/includes/TwoColConflictHooks.php(124): BetaFeatures::isFeatureEnabled(User, string)
  #10 /srv/mediawiki/php-1.31.0-wmf.2/includes/Hooks.php(177): TwoColConflictHooks::onSpecialPage_initList(array)
  #11 /srv/mediawiki/php-1.31.0-wmf.2/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
  #12 /srv/mediawiki/php-1.31.0-wmf.2/includes/specialpage/SpecialPageFactory.php(268): Hooks::run(string, array)
  #13 /srv/mediawiki/php-1.31.0-wmf.2/includes/specialpage/SpecialPageFactory.php(285): SpecialPageFactory::getPageList()
  #14 /srv/mediawiki/php-1.31.0-wmf.2/includes/specialpage/SpecialPageFactory.php(660): SpecialPageFactory::getAliasList()
  #15 /srv/mediawiki/php-1.31.0-wmf.2/includes/specialpage/SpecialPage.php(98): SpecialPageFactory::getLocalNameFor(string, boolean)
  #16 /srv/mediawiki/php-1.31.0-wmf.2/includes/specialpage/SpecialPage.php(85): SpecialPage::getTitleValueFor(string, boolean, string)
  #17 /srv/mediawiki/php-1.31.0-wmf.2/extensions/VisualEditor/VisualEditor.hooks.php(846): SpecialPage::getTitleFor(string)
  #18 /srv/mediawiki/php-1.31.0-wmf.2/includes/Hooks.php(177): VisualEditorHooks::onResourceLoaderGetConfigVars(array)
  #19 /srv/mediawiki/php-1.31.0-wmf.2/includes/Hooks.php(205): Hooks::callHook(string, array, array, NULL)
  #20 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoaderStartUpModule.php(118): Hooks::run(string, array)
  #21 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoaderStartUpModule.php(403): ResourceLoaderStartUpModule->getConfigSettings(DerivativeResourceLoaderContext)
  #22 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoaderModule.php(844): ResourceLoaderStartUpModule->getDefinitionSummary(DerivativeResourceLoaderContext)
  #23 /srv/mediawiki/php-1.31.0-wmf.2/includes/resourceloader/ResourceLoader.php(667): ResourceLoaderModule->getVersionHash(DerivativeResourceLoaderContext)

Still visible on the beta cluster (as the change is on master) while making requests such as:

Change 382432 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/TwoColConflict@master] onSpecialPage_initList get user from context & check type

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

Change 382432 merged by Tobias Gritschacher:
[mediawiki/extensions/TwoColConflict@master] onSpecialPage_initList get user from context & check type

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

On Beta logstash we can see the occurrences of each error:

It looks like the function call on null has so far only occurred once... but sessions are disabled occurs lots.
The patch above only fixes the function call on null issue.

Change 382453 had a related patch set uploaded (by Addshore; owner: Addshore):
[mediawiki/extensions/TwoColConflict@master] Dont run onSpecialPage_initList if MW_NO_SESSION defined

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

Change 382453 merged by jenkins-bot:
[mediawiki/extensions/TwoColConflict@master] Dont run onSpecialPage_initList if MW_NO_SESSION defined

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

The change is now in master and the exception can no longer be seen @ https://de.wiktionary.beta.wmflabs.org/w/load.php?debug=false&lang=de&modules=startup&only=scripts&skin=vector

I'll check logstash for beta in a little bit and ensure there are no more occurrences before closing this ticket.

Addshore closed this task as Resolved.Oct 5 2017, 4:26 PM
Addshore moved this task from Doing to Done on the WMDE-QWERTY-Sprint-2017-09-19 board.
Addshore moved this task from In Progress to Done ✔️ on the User-Addshore board.
Tobi_WMDE_SW moved this task from Proposed to Done on the WMDE-QWERTY-Team board.Oct 17 2017, 1:09 PM
Tobi_WMDE_SW moved this task from Done to Demoed on the WMDE-QWERTY-Team board.Oct 17 2017, 2:05 PM