[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Page MenuHomePhabricator

PHP Notice: Undefined index: path
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   PHP Notice: Undefined index: path
exception.trace
from /srv/mediawiki/php-1.41.0-wmf.28/includes/ExternalLinks/LinkFilter.php(196)
#0 /srv/mediawiki/php-1.41.0-wmf.28/includes/ExternalLinks/LinkFilter.php(196): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.41.0-wmf.28/includes/ExternalLinks/LinkFilter.php(249): MediaWiki\ExternalLinks\LinkFilter::makeIndexes(string, boolean)
#2 /srv/mediawiki/php-1.41.0-wmf.28/includes/deferred/LinksUpdate/ExternalLinksTable.php(20): MediaWiki\ExternalLinks\LinkFilter::getIndexedUrlsNonReversed(array)
#3 /srv/mediawiki/php-1.41.0-wmf.28/includes/deferred/LinksUpdate/LinksTableGroup.php(272): MediaWiki\Deferred\LinksUpdate\ExternalLinksTable->setParserOutput(ParserOutput)
#4 /srv/mediawiki/php-1.41.0-wmf.28/includes/deferred/LinksUpdate/LinksTableGroup.php(294): MediaWiki\Deferred\LinksUpdate\LinksTableGroup->get(string)
#5 /srv/mediawiki/php-1.41.0-wmf.28/includes/deferred/LinksUpdate/LinksUpdate.php(234): MediaWiki\Deferred\LinksUpdate\LinksTableGroup->getAll()
#6 /srv/mediawiki/php-1.41.0-wmf.28/includes/deferred/DeferredUpdates.php(463): MediaWiki\Deferred\LinksUpdate\LinksUpdate->doUpdate()
#7 /srv/mediawiki/php-1.41.0-wmf.28/includes/deferred/RefreshSecondaryDataUpdate.php(103): DeferredUpdates::attemptUpdate(MediaWiki\Deferred\LinksUpdate\LinksUpdate)
#8 /srv/mediawiki/php-1.41.0-wmf.28/includes/deferred/DeferredUpdates.php(463): RefreshSecondaryDataUpdate->doUpdate()
#9 /srv/mediawiki/php-1.41.0-wmf.28/includes/deferred/DeferredUpdates.php(192): DeferredUpdates::attemptUpdate(RefreshSecondaryDataUpdate)
#10 /srv/mediawiki/php-1.41.0-wmf.28/includes/deferred/DeferredUpdates.php(276): DeferredUpdates::run(RefreshSecondaryDataUpdate)
#11 /srv/mediawiki/php-1.41.0-wmf.28/includes/deferred/DeferredUpdatesScope.php(264): DeferredUpdates::{closure}(RefreshSecondaryDataUpdate, integer)
#12 /srv/mediawiki/php-1.41.0-wmf.28/includes/deferred/DeferredUpdatesScope.php(196): DeferredUpdatesScope->processStageQueue(integer, integer, Closure)
#13 /srv/mediawiki/php-1.41.0-wmf.28/includes/deferred/DeferredUpdates.php(295): DeferredUpdatesScope->processUpdates(integer, Closure)
#14 /srv/mediawiki/php-1.41.0-wmf.28/includes/MediaWiki.php(1169): DeferredUpdates::doUpdates()
#15 /srv/mediawiki/php-1.41.0-wmf.28/includes/MediaWiki.php(887): MediaWiki->restInPeace()
#16 /srv/mediawiki/php-1.41.0-wmf.28/includes/MediaWiki.php(639): MediaWiki->doPostOutputShutdown()
#17 /srv/mediawiki/php-1.41.0-wmf.28/index.php(50): MediaWiki->run()
#18 /srv/mediawiki/php-1.41.0-wmf.28/index.php(46): wfIndexMain()
#19 /srv/mediawiki/w/index.php(3): require(string)
#20 {main}
Impact
Notes

Details

Request URL
https://en.wikinews.org/w/index.php?action=submit&title=*

Event Timeline

Looks like this is triggered from:

		// URI RFC identifies the email/server part of mailto or news protocol as 'path',
		// while we want to match the email's domain or news server the same way we are
		// matching hosts for other URLs.
		if ( in_array( $bits['scheme'], [ 'mailto', 'news' ] ) ) {
			$bits['host'] = $bits['path'];
			$bits['path'] = '';
		}

$bits = wfParseUrl( $url ); and wfParseUrl says 'path: path including the leading /. Will be missing when empty (e.g. 'http://example.com')', so is this a malformed link? Either way it shouldn't error.

Change 961801 had a related patch set uploaded (by Jforrester; author: Jforrester):

[mediawiki/core@master] LinkFilter::makeIndexes: Don't explode if the 'host' key is missing

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

I think I found how what causes this. (news://comp.compression is from one of the articles causing the error)

$bits = wfParseUrl( "news://comp.compression" );
[
  "scheme" => "news",
  "host" => "comp.compression",
  "delimiter" => ":",
]

Here, the host is already filled, and there's no path (this is the format MediaWiki wants to parse this kind of scheme)

This only happens for news: scheme however, because it's one of the few URI schemes that support double formats (with // delimiter and without) e.g.
news://comp.compression and news:comp.compression can both be correct.

We should just detect this case and leave things as they're (not attempt to get the host from path key).

I have added a filter on mediawiki-NEW-errors dashboard using:

{
  "query": {
    "bool": {
      "must": [
        {
          "match_phrase": {
            "log.origin.file.name": "/srv/mediawiki/php-1.41.0-wmf.29/includes/ExternalLinks/LinkFilter.php"
          }
        },
        {
          "match_phrase": {
            "log.origin.file.line": "196"
          }
        }
      ]
    }
  }
}

It is tied to 1.41.0-wmf.29, so that filter will need to be adjusted as 1.41.0-wmf.30 is rolled on the cluster.

Change 961801 merged by jenkins-bot:

[mediawiki/core@master] LinkFilter::makeIndexes: Don't explode if the 'host' key is missing for news://

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

I guess we can backport the fix to 1.41.0-wmf.30 to cut the error logging and I guess confirms everything works? I can do the backports tomorrow morning (~ 13 hours from now)

I guess we can backport the fix to 1.41.0-wmf.30 to cut the error logging and I guess confirms everything works? I can do the backports tomorrow morning (~ 13 hours from now)

I added the failing content as a test case, so I don't think the effort of a backport is strictly necessary, but if you wish.

If that causes no impact, sure I can simply amend the filter to take in account wmf.30 and filter out the error until the patch lands next week. Lets not bother if that has no impact.