Page MenuHomePhabricator

500 error on Special:EditEventRegistration and Special:EnableEventRegistration on betacluster and local
Closed, ResolvedPublicBUG REPORT

Description

Visiting Special:EnableEventRegistration or editing an existing event through Special:EnableEventRegistration/{eventID} on betacluster returns a 500 error.

To replicate, log in and go here:
https://en.wikipedia.beta.wmflabs.org/wiki/Special:EnableEventRegistration

You can also see this in the pixel report:
https://pixel.wmcloud.org/reports/campaign-events/index.html

And the following is returned when visiting Special:EnableEventRegistration on my local:

Fatal error: OOUI\Exception: OOUI\Theme::singleton was called with no singleton theme set. in /var/www/html/w/vendor/oojs/oojs-ui/php/Theme.php:31 Stack trace: #0 /var/www/html/w/vendor/oojs/oojs-ui/php/Element.php(259): OOUI\Theme::singleton() #1 /var/www/html/w/vendor/oojs/oojs-ui/php/Tag.php(510): OOUI\Element->toString() #2 /var/www/html/w/includes/htmlform/HTMLForm.php(995): OOUI\Tag->__toString() #3 /var/www/html/w/extensions/CampaignEvents/src/Special/AbstractEventRegistrationSpecialPage.php(534): HTMLForm->addFooterHtml() #4 /var/www/html/w/includes/specialpage/FormSpecialPage.php(177): MediaWiki\Extension\CampaignEvents\Special\AbstractEventRegistrationSpecialPage->alterForm() #5 /var/www/html/w/includes/specialpage/FormSpecialPage.php(228): MediaWiki\SpecialPage\FormSpecialPage->getForm() #6 /var/www/html/w/extensions/CampaignEvents/src/Special/AbstractEventRegistrationSpecialPage.php(175): MediaWiki\SpecialPage\FormSpecialPage->execute() #7 /var/www/html/w/includes/specialpage/SpecialPage.php(727): MediaWiki\Extension\CampaignEvents\Special\AbstractEventRegistrationSpecialPage->execute() #8 /var/www/html/w/includes/specialpage/SpecialPageFactory.php(1652): MediaWiki\SpecialPage\SpecialPage->run() #9 /var/www/html/w/includes/MediaWiki.php(359): MediaWiki\SpecialPage\SpecialPageFactory->executePath() #10 /var/www/html/w/includes/MediaWiki.php(954): MediaWiki->performRequest() #11 /var/www/html/w/includes/MediaWiki.php(607): MediaWiki->main() #12 /var/www/html/w/index.php(50): MediaWiki->run() #13 /var/www/html/w/index.php(46): wfIndexMain() #14 {main} in /var/www/html/w/vendor/oojs/oojs-ui/php/Tag.php on line 512

Event Timeline

This error looked extremely familiar to me, I believe this happens when OOUI isn't setup correctly.

We've had this before:

Both had the same issue, I think it's mostly a matter of enableOOUI() on output page, but see https://www.mediawiki.org/wiki/OOUI/Using_OOUI_in_MediaWiki#Before_you_start

I can reproduce this locally as well.

Both had the same issue, I think it's mostly a matter of enableOOUI() on output page, but see https://www.mediawiki.org/wiki/OOUI/Using_OOUI_in_MediaWiki#Before_you_start

Indeed... The thing is, we haven't made significant changes to that special page's code in months, so maybe something regressed in core? Gonna run a git bisect.

maybe something regressed in core? Gonna run a git bisect.

And indeed, git bisect points to https://gerrit.wikimedia.org/r/c/mediawiki/core/+/986555 (OOUIHTMLForm: Enable OOUI only if the form is going to be displayed).

I haven't checked the details of that patch yet, and therefore I still don't know if our special page is doing something wrong (but it previously wasn't apparent), or if it's the core change that needs to be redone to support something that should be supported.

I'm also going to check if there are more special pages affected.

I'm also going to check if there are more special pages affected.

I've checked all special pages available in beta enwiki, but Special:EnableEventRegistration and Special:EditEventRegistration are the only two affected. I think the rationale for the core change is sensible. Consistency with VFormHTMLForm and CodexHTMLForm is not necessarily a good thing (the former is really old and predates OOUI, the latter is very new and it looks like it might be based off of the former), but it doesn't really matter.

These two special pages throw an exception because they create a MessageWidget and append it to the form as a footer in ::alterForm(), which is called before showing the form (HTMLForm::getHTML()).

I will see how to best fix the issue for these special pages. I'm unsure if this needs to somehow be documented in FormSpecialPage or elsewhere.

Change 987972 had a related patch set uploaded (by Daimona Eaytoy; author: Daimona Eaytoy):

[mediawiki/extensions/CampaignEvents@master] Enable OOUI when needed in Special:(Enable|Edit)EventRegistration

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

Change 987972 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Enable OOUI when needed in Special:(Enable|Edit)EventRegistration

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

Oops, thanks for debugging that.

For now I'll hope that this is the only affected special page, but if more of them crop up, we can think about reverting or coming up with a different fix for the other bug.

This is now correctly displaying in betacluster at Special:EnableEventRegistration and Special:EditEventRegistration

It is fixed in my local env as well

And there are no longer any errors in the pixel report:
https://pixel.wmcloud.org/reports/campaign-events/index.html

Marking as done / resolved.