Page MenuHomePhabricator

Better error handling when RCFeed are enabled but PHP doesn't have php-sockets extension installed
Open, Needs TriagePublic

Description

When enabling RCFeed ( $wgRCFeeds ) and PHP doesn't have the php-sockets extension, if you save an edit, it gets saved but no entry is inserted in the recent changes table. It doesn't add a job to update it neither.

Hopefully the debug log displays this information (this happens with a udp URL at least):

[error] [31c24f9a84f1fe30a76eaa4c] /index.php?title=Hijo&action=submit   ErrorException from line 66 of /home/www/lib/mediawiki-1.30.0/includes/libs/UDPTransport.php: PHP Notice: Use of undefined constant AF_INET - assumed 'AF_INET'
#0 /home/www/lib/mediawiki-1.30.0/includes/libs/UDPTransport.php(66): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /home/www/lib/mediawiki-1.30.0/includes/rcfeed/UDPRCFeedEngine.php(33): UDPTransport::newFromString(string)
#2 /home/www/lib/mediawiki-1.30.0/includes/rcfeed/FormattedRCFeed.php(66): UDPRCFeedEngine->send(array, string)
#3 /home/www/lib/mediawiki-1.30.0/includes/changes/RecentChange.php(432): FormattedRCFeed->notify(RecentChange, NULL)
#4 /home/www/lib/mediawiki-1.30.0/includes/changes/RecentChange.php(354): RecentChange->notifyRCFeeds()
#5 /home/www/lib/mediawiki-1.30.0/includes/changes/RecentChange.php(629): RecentChange->save()
#6 [internal function]: RecentChange::{closure}()
#7 /home/www/lib/mediawiki-1.30.0/includes/deferred/MWCallableUpdate.php(30): call_user_func(Closure)
#8 /home/www/lib/mediawiki-1.30.0/includes/deferred/DeferredUpdates.php(257): MWCallableUpdate->doUpdate()
#9 /home/www/lib/mediawiki-1.30.0/includes/deferred/DeferredUpdates.php(210): DeferredUpdates::runUpdate(MWCallableUpdate, Wikimedia\Rdbms\LBFactorySimple, string, integer)
#10 /home/www/lib/mediawiki-1.30.0/includes/deferred/DeferredUpdates.php(131): DeferredUpdates::execute(array, string, integer)
#11 /home/www/lib/mediawiki-1.30.0/includes/MediaWiki.php(895): DeferredUpdates::doUpdates(string)
#12 /home/www/lib/mediawiki-1.30.0/includes/MediaWiki.php(719): MediaWiki->restInPeace(string, boolean)
#13 /home/www/lib/mediawiki-1.30.0/includes/MediaWiki.php(740): MediaWiki->{closure}()
#14 /home/www/lib/mediawiki-1.30.0/includes/MediaWiki.php(553): MediaWiki->doPostOutputShutdown(string)
#15 /home/www/lib/mediawiki-1.30.0/index.php(43): MediaWiki->run()
#16 {main}
[fatal] [bb713578] PHP Fatal Error: Call to undefined function socket_create()

MediaWiki should probably check for socket_create if $wgRCFeeds is set, and fail early (prevent the save at all), or catch the error, log it and continue without breaking all jobs that need to be inserted.

Event Timeline

Will composer.json accept ext-sockets as a suggests?

Looks like it doesn't error at least,

We could add it as an installer warning type thing too

kostajh moved this task from Inbox to Triaged on the Growth-Team board.
kostajh subscribed.

Adding Platform Engineering for awareness; moving to triaged as it's not something Growth-Team will work on in the short-to-medium term.