Page MenuHomePhabricator

TypeError: explode() expects parameter 2 to be string, null given
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
labels.normalized_message
[{reqId}] {exception_url}   TypeError: explode() expects parameter 2 to be string, null given
error.stack_trace
from /srv/mediawiki/php-1.42.0-wmf.2/extensions/CampaignEvents/src/TrackingTool/Tool/WikiEduDashboard.php(292)
#0 /srv/mediawiki/php-1.42.0-wmf.2/extensions/CampaignEvents/src/TrackingTool/Tool/WikiEduDashboard.php(292): explode(string, NULL)
#1 /srv/mediawiki/php-1.42.0-wmf.2/extensions/CampaignEvents/src/TrackingTool/Tool/WikiEduDashboard.php(247): MediaWiki\Extension\CampaignEvents\TrackingTool\Tool\WikiEduDashboard->makePostRequest(string, integer, string, boolean, array)
#2 /srv/mediawiki/php-1.42.0-wmf.2/extensions/CampaignEvents/src/TrackingTool/Tool/WikiEduDashboard.php(187): MediaWiki\Extension\CampaignEvents\TrackingTool\Tool\WikiEduDashboard->syncParticipants(MediaWiki\Extension\CampaignEvents\Event\ExistingEventRegistration, string, boolean)
#3 /srv/mediawiki/php-1.42.0-wmf.2/extensions/CampaignEvents/src/TrackingTool/TrackingToolEventWatcher.php(311): MediaWiki\Extension\CampaignEvents\TrackingTool\Tool\WikiEduDashboard->addParticipant(MediaWiki\Extension\CampaignEvents\Event\ExistingEventRegistration, string, MediaWiki\Extension\CampaignEvents\MWEntity\CentralUser, boolean)
#4 /srv/mediawiki/php-1.42.0-wmf.2/includes/deferred/MWCallableUpdate.php(40): MediaWiki\Extension\CampaignEvents\TrackingTool\TrackingToolEventWatcher->MediaWiki\Extension\CampaignEvents\TrackingTool\{closure}()
#5 /srv/mediawiki/php-1.42.0-wmf.2/includes/deferred/DeferredUpdates.php(463): MWCallableUpdate->doUpdate()
#6 /srv/mediawiki/php-1.42.0-wmf.2/includes/deferred/DeferredUpdates.php(192): DeferredUpdates::attemptUpdate(MWCallableUpdate)
#7 /srv/mediawiki/php-1.42.0-wmf.2/includes/deferred/DeferredUpdates.php(276): DeferredUpdates::run(MWCallableUpdate)
#8 /srv/mediawiki/php-1.42.0-wmf.2/includes/deferred/DeferredUpdatesScope.php(267): DeferredUpdates::{closure}(MWCallableUpdate, integer)
#9 /srv/mediawiki/php-1.42.0-wmf.2/includes/deferred/DeferredUpdatesScope.php(196): DeferredUpdatesScope->processStageQueue(integer, integer, Closure)
#10 /srv/mediawiki/php-1.42.0-wmf.2/includes/deferred/DeferredUpdates.php(295): DeferredUpdatesScope->processUpdates(integer, Closure)
#11 /srv/mediawiki/php-1.42.0-wmf.2/includes/MediaWiki.php(1168): DeferredUpdates::doUpdates()
#12 /srv/mediawiki/php-1.42.0-wmf.2/includes/MediaWiki.php(886): MediaWiki->restInPeace()
#13 /srv/mediawiki/php-1.42.0-wmf.2/includes/Rest/EntryPoint.php(236): MediaWiki->doPostOutputShutdown()
#14 /srv/mediawiki/php-1.42.0-wmf.2/includes/Rest/EntryPoint.php(135): MediaWiki\Rest\EntryPoint->execute()
#15 /srv/mediawiki/php-1.42.0-wmf.2/rest.php(31): MediaWiki\Rest\EntryPoint::main()
#16 /srv/mediawiki/w/rest.php(3): require(string)
#17 {main}
Notes
  • Might be new in 1.42.0-wmf.1 (not seeing these prior to last week in the past 30 days)
  • Only 4 in the past 30 days
  • All on metawiki

Details

Request URL
https://meta.wikimedia.org/w/rest.php/campaignevents/v0/event_registration/180/participants/self

Event Timeline

Daimona added subscribers: Ragesoss, Daimona.

Relevant code:

$contentTypeHeader = $req->getResponseHeader( 'Content-Type' );
$contentType = strtolower( explode( ';', $contentTypeHeader )[0] ); // Line 292

It looks like the P&E Dashboard is not sending a content-type in the response. This likely indicates an issue on the Dashboard's end, as we haven't changed anything recently.

Our code should be more defensive and return early, while also logging the failure. But most importantly, I'd like to see if there's anything wrong with the Dashboard in the first place.

Do you have timestamps for when this occurred? The database went down at some point recently, which might or might not explain the problem, if these happened when the Dashboard was basically completely un-operational.

Do you have timestamps for when this occurred? The database went down at some point recently, which might or might not explain the problem, if these happened when the Dashboard was basically completely un-operational.

Yup, sorry. There has been 1 occurrence on October 21 at 11:11:25 UTC, and then 3 occurrences today at 12:20:18, 12:25:55, and 12:51:30 UTC.

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

[mediawiki/extensions/CampaignEvents@master] Prevent crash when the P&E Dashboard sends no content-type

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

Change 969176 merged by jenkins-bot:

[mediawiki/extensions/CampaignEvents@master] Prevent crash when the P&E Dashboard sends no content-type

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

Marking as done because there's no way to test this.