Page MenuHomePhabricator

/wiki/Special:SecurePoll/create Error: Call to a member function getId() on null
Closed, ResolvedPublic

Description

2021-08-12 02:32:54 [2b2da985-852d-4164-910d-3fca6ec239f0] mw2269 votewiki 1.37.0-wmf.18 exception ERROR: [2b2da985-852d-4164-910d-3fca6ec239f0] /wiki/Special:SecurePoll/create   Error: Call to a member function getId() on null {"exception_url":"/wiki/Special:SecurePoll/create","reqId":"2b2da985-852d-4164-910d-3fca6ec239f0","caught_by":"entrypoint"} 
[Error Error] (/srv/mediawiki/php-1.37.0-wmf.18/extensions/SecurePoll/includes/Crypt/GpgCrypt.php:216) Call to a member function getId() on null
  #0 /srv/mediawiki/php-1.37.0-wmf.18/extensions/SecurePoll/includes/Crypt/GpgCrypt.php(157): MediaWiki\Extensions\SecurePoll\Crypt\GpgCrypt->setupHome()
  #1 /srv/mediawiki/php-1.37.0-wmf.18/includes/htmlform/HTMLFormField.php(322): MediaWiki\Extensions\SecurePoll\Crypt\GpgCrypt::checkEncryptKey(string, array, OOUIHTMLForm)
  #2 /srv/mediawiki/php-1.37.0-wmf.18/includes/htmlform/HTMLForm.php(693): HTMLFormField->validate(string, array)
  #3 /srv/mediawiki/php-1.37.0-wmf.18/includes/htmlform/HTMLForm.php(608): HTMLForm->trySubmit()
  #4 /srv/mediawiki/php-1.37.0-wmf.18/extensions/SecurePoll/includes/Pages/CreatePage.php(508): HTMLForm->tryAuthorizedSubmit()
  #5 /srv/mediawiki/php-1.37.0-wmf.18/extensions/SecurePoll/includes/SpecialSecurePoll.php(70): MediaWiki\Extensions\SecurePoll\Pages\CreatePage->execute(array)
  #6 /srv/mediawiki/php-1.37.0-wmf.18/includes/specialpage/SpecialPage.php(646): MediaWiki\Extensions\SecurePoll\SpecialSecurePoll->execute(string)
  #7 /srv/mediawiki/php-1.37.0-wmf.18/includes/specialpage/SpecialPageFactory.php(1365): SpecialPage->run(string)
  #8 /srv/mediawiki/php-1.37.0-wmf.18/includes/MediaWiki.php(314): MediaWiki\SpecialPage\SpecialPageFactory->executePath(string, RequestContext)
  #9 /srv/mediawiki/php-1.37.0-wmf.18/includes/MediaWiki.php(925): MediaWiki->performRequest()
  #10 /srv/mediawiki/php-1.37.0-wmf.18/includes/MediaWiki.php(559): MediaWiki->main()
  #11 /srv/mediawiki/php-1.37.0-wmf.18/index.php(53): MediaWiki->run()
  #12 /srv/mediawiki/php-1.37.0-wmf.18/index.php(46): wfIndexMain()
  #13 /srv/mediawiki/w/index.php(3): require(string)

Event Timeline

2 instantiations of GpgCrypt do...

		$that = new GpgCrypt( null, null );
		$status = $that->setupHome();

Which then means things like this immediately fail (like seen above)...

		LoggerFactory::getInstance( 'AdHocDebug' )->info(
			'Created the temp directory for GPG decryption',
			[
				'electionId' => $this->election->getId(),
				'tmpDir' => $this->homeDir,
			]
		);

Beacause $this->election is only ever null.

Change 711709 had a related patch set uploaded (by Reedy; author: Reedy):

[mediawiki/extensions/SecurePoll@master] Partial Revert \"Add ad-hoc logging to tally process\"

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

I don't know if we want to backport this to .17/.18 for prod... Or someone wants to propose another patch to have the logging work in the conditions where $this->election is null

Change 711945 had a related patch set uploaded (by Phuedx; author: Phuedx):

[mediawiki/extensions/SecurePoll@master] Make ad-hoc logging handle election not being set

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

I'm going to backport it. It looks like it only needs to go to .18 because it was only cherry-picked to .18 in the first place.

Hmm, looks like there was another patch 3 minutes ago. I can backport that one too I guess.

Change 711945 merged by jenkins-bot:

[mediawiki/extensions/SecurePoll@master] Make ad-hoc logging handle election not being set

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

Change 711711 had a related patch set uploaded (by Tim Starling; author: Phuedx):

[mediawiki/extensions/SecurePoll@wmf/1.37.0-wmf.18] Make ad-hoc logging handle election not being set

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

Change 711711 merged by jenkins-bot:

[mediawiki/extensions/SecurePoll@wmf/1.37.0-wmf.18] Make ad-hoc logging handle election not being set

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

Mentioned in SAL (#wikimedia-operations) [2021-08-12T06:49:28Z] <tstarling@deploy1002> Synchronized php-1.37.0-wmf.18/extensions/SecurePoll/includes/Crypt/GpgCrypt.php: fix for T288711 failure of election creation (duration: 01m 09s)

@jrbs please confirm that it is fixed.

Confirmed, just created the election earlier. Looks good to me!

tstarling claimed this task.

Change 711709 abandoned by Reedy:

[mediawiki/extensions/SecurePoll@master] Partial Revert \"Add ad-hoc logging to tally process\"

Reason:

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