Page MenuHomePhabricator

PHP Notice: Undefined index from PagedTiffHandler_body.php:269
Closed, ResolvedPublicPRODUCTION ERROR

Description

[{exception_id}] {exception_url} ErrorException from line 269 of /srv/mediawiki/php-1.32.0-wmf.14/extensions/PagedTiffHandler/PagedTiffHandler_body.php: PHP Notice: Undefined index: 41

Example URL: https://commons.wikimedia.org/w/index.php?title=File:Ackermann_-_%C5%92uvres_de_L._Ackermann.tif&page=40

Trace log
message:
PHP Notice: Undefined index: 41

wiki: commons.wikimedia.org

exception.trace:
#0 /srv/mediawiki/php-1.32.0-wmf.14/extensions/PagedTiffHandler/PagedTiffHandler_body.php(269): MWExceptionHandler::handleError(integer, string, string, integer, array, array)
#1 /srv/mediawiki/php-1.32.0-wmf.14/includes/filerepo/file/File.php(1079): PagedTiffHandler->normaliseParams(LocalFile, array)
#2 /srv/mediawiki/php-1.32.0-wmf.14/includes/Linker.php(565): File->transform(array)
#3 /srv/mediawiki/php-1.32.0-wmf.14/includes/Linker.php(500): Linker::makeThumbLink2(Title, LocalFile, array, array)
#4 /srv/mediawiki/php-1.32.0-wmf.14/includes/page/ImagePage.php(474): Linker::makeThumbLinkObj(Title, LocalFile, string, string, string, array)
#5 /srv/mediawiki/php-1.32.0-wmf.14/includes/page/ImagePage.php(138): ImagePage->openShowImage()
#6 /srv/mediawiki/php-1.32.0-wmf.14/includes/actions/ViewAction.php(68): ImagePage->view()
#7 /srv/mediawiki/php-1.32.0-wmf.14/includes/MediaWiki.php(500): ViewAction->show()
#8 /srv/mediawiki/php-1.32.0-wmf.14/includes/MediaWiki.php(294): MediaWiki->performAction(ImagePage, Title)
#9 /srv/mediawiki/php-1.32.0-wmf.14/includes/MediaWiki.php(867): MediaWiki->performRequest()
#10 /srv/mediawiki/php-1.32.0-wmf.14/includes/MediaWiki.php(524): MediaWiki->main()
#11 /srv/mediawiki/php-1.32.0-wmf.14/index.php(42): MediaWiki->run()
#12 /srv/mediawiki/w/index.php(3): include(string)
#13 {main}

Source at PagedTiffHandler_body:251.

	function normaliseParams( $image, &$params ) {
		if ( isset( $params['page'] ) ) {
			$params['page'] = $this->adjustPage( $image, $params['page'] );
		} else {
			$params['page'] = $this->firstPage( $image );
		}
		if ( isset( $params['lossy'] ) ) {
			// ..
		} else {
			$page = $params['page'];
			$data = $this->getMetaArray( $image );
			if ( !$this->isMetadataError( $data )
				&& strtolower( $data['page_data'][$page]['alpha'] ) == 'true'

Event Timeline

We need to find out how often this error is happening and if it has any serious impact to prioritize.

@Jhernandez Thanks. I wasn't entirely sure whether you're asking me or documenting for future handling within the team. Anyhow, the errors can be analysed at https://logstash.wikimedia.org/app/kibana#/dashboard/mediawiki-errors (query "PagedTiffHandler" in last 7 days).

The tiff contains 199 pages, but starts by 2 and ends on 213 with some gaps, but the preview of mediawiki assumed the page numbers are straight forward. This also makes it impossible to visit pages 200 to 213

Missing 1, 32, 41, 63, 76, 103, 107, 116, 120, 154, 167, 197, 201, 210

https://commons.wikimedia.org/w/api.php?action=query&titles=File:Ackermann_-_%C5%92uvres_de_L._Ackermann.tif&prop=imageinfo&iiprop=metadata

{
    "name": "page_count",
    "value": 199
},
{
    "name": "first_page",
    "value": 2
},
{
    "name": "last_page",
    "value": 213
},

But first and last are reset in PagedTiffImage::finish, maybe the array index of page_data must reset too

Ye @Krinkle just documenting next steps for me or the team to look into. Thanks for the report. Thanks @Umherirrender for the example.

I've looked at the logs and I've seen 10 instances of the error mostly in commons in the last 30 days:

Screen Shot 2018-08-17 at 17.33.06.png (1,116×372 px, 126 KB)

We have to look into it but doesn't seem extremely urgent. If anyone wants to dig in, feel free.

@Jhernandez Understandable. Note that if the resulting behaviour is considered acceptable for the time being (which it sounds like) , it might scale better to silence it the application error (catch, suppress , or lower severity), so that it doesn't register in our shared infrastructure as a problem. Especially because it makes it harder to find new problems each week, and because it might falsely cause deployment to fail or alerts to fire.

The tiff has 212 pages, mediawiki metadata sees only 199. The page number 1 is missing, therefor the first and second page on the image page is same, because the page with the lowest number (2) is the first page, but when requesting a page per parameter, the page with that number is returned. That results in two pages which are the same

But it seems mediawiki can see the page with number 1
https://upload.wikimedia.org/wikipedia/commons/thumb/5/51/Ackermann_-_%C5%92uvres_de_L._Ackermann.tif/lossy-page1-541px-Ackermann_-_%C5%92uvres_de_L._Ackermann.tif.jpg
which looks different than the first page on the file page, that is page 2
https://upload.wikimedia.org/wikipedia/commons/thumb/5/51/Ackermann_-_%C5%92uvres_de_L._Ackermann.tif/lossy-page2-541px-Ackermann_-_%C5%92uvres_de_L._Ackermann.tif.jpg

Maybe it is enough to refresh the metadata for this image.

The other solution is to fix PagedTiffHandler to store the metadata without gaps, because the multi page navigation assume that the pages are stored without gaps to navigate through all of them.

mmodell changed the subtype of this task from "Task" to "Production Error".Aug 28 2019, 11:09 PM

I wasn't aware of this ticket when I fixed this bug: https://gerrit.wikimedia.org/r/659307. It's already merged. I believe this ticket can be closed, and the exception(s) removed from the mediawiki-new-errors board: https://logstash.wikimedia.org/app/dashboards#/view/0a9ecdc0-b6dc-11e8-9d8f-dbc23b470465?_g=h@8130aac&_a=h@f4fbfdc.

Does that mean that the status of this ticket should be changed to resolved?

Jdforrester-WMF subscribed.

I believe this ticket can be closed, and the exception(s) removed from the mediawiki-new-errors board: https://logstash.wikimedia.org/app/dashboards#/view/0a9ecdc0-b6dc-11e8-9d8f-dbc23b470465?_g=h@8130aac&_a=h@f4fbfdc.

Done. Thanks!

Does that mean that the status of this ticket should be changed to resolved?

Yes.