Page MenuHomePhabricator

Pager queries are performed twice when Special:Investigate forms are submitted
Closed, ResolvedPublic

Description

This was noticed in T255688#6304222.

When the form is submitted successfully:

  • SpecialInvestigate::execute calls FormSpecialPage::execute
  • FormSpecialPage::execute calls SpecialInvestigate::onSubmit (via HTMLForm::show > HTMLForm::tryAuthorizedSubmit)
  • SpecialInvestigate::onSubmit sets a redirect on the OutputPage
  • SpecialInvestigate::execute continues, calling SpecialInvestigate::addTabContent, which initializes the pagers and performs any queries

Then, following the redirect:

  • SpecialInvestigate::execute calls FormSpecialPage::execute
  • SpecialInvestigate::onSubmit is not called, because HTMLForm::tryAuthorizedSubmit fails (the form wasn't submitted)
  • SpecialInvestigate::execute continues, calling SpecialInvestigate::addTabContent, which initializes the pagers and performs any queries

SpecialInvestigate::execute should not continue to initializing the pagers after the redirect has been set.

Event Timeline

Change 616854 had a related patch set uploaded (by Dbarratt; owner: Dbarratt):
[mediawiki/extensions/CheckUser@master] Skip page content if the result of the form submission is a redirect

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

Tchanders moved this task from Untriaged to The Letter Song on the Anti-Harassment-Team board.
Tchanders added a subscriber: dom_walden.

@dom_walden Just a reminder that this came up because of T255688 - in case that affects how you test it.

Change 616854 merged by jenkins-bot:
[mediawiki/extensions/CheckUser@master] Skip page content if the result of the form submission is a redirect

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

@dbarratt @Tchanders Just to check my understanding here.

I setup profiling on my vagrant wiki to see which methods get called when I submit a new target, before and after this change.

Before the change
Profile output for the first POST:


Profile output for the redirected GET:

After the change
Profile output for the first POST:


Profile output for the redirected GET:

The main difference seems to be that the first POST no longer calls SpecialInvestigate::addTabContent. Otherwise, are we seeing what we want to see?

(Sorry the format isn't necessarily very convenient. Some of the profiling tools are no longer very well supported, so this was the best I could do :))

@dom_walden Yes, that looks right. (I can only see the top 100, but addTabContent would be up there if it were being called.)

@dom_walden Yes, that looks right. (I can only see the top 100, but addTabContent would be up there if it were being called.)

Oh, that's a really good point.

Just in case, I rechecked with all the results showing. addTabContent still does not appear.

For a couple of different operations including:

  • starting a new investigation
  • adding a new target or filter to investigation (this caused the issue in the description)
  • changing tabs

I checked that addTabContent is only called once, and only one "query" event is logged.

I also briefly checked that the output appears to be as it should and the DB query getting the data for the Compare or Preliminary Check table is correct.