Page MenuHomePhabricator

PHP Warning: unpack(): Type H: not enough input, need 4, have 0
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.36.0-wmf.2

message
PHP Warning: unpack(): Type H: not enough input, need 4, have 0

Impact

There's a hundred of these in the past few hours, all on commonswiki. The new train is starting soon, would appreciate a quick triage and, if necessary, fix.

Notes

Details

Request ID
c7a707bb-7aae-4060-998b-8046a04f5626
Request URL
https://commons.wikimedia.org/w/api.php
Stack Trace
exception.trace
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.36.0-wmf.2/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(1648): unpack(string, string)
#2 /srv/mediawiki/php-1.36.0-wmf.2/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(2003): getid3_quicktime->QuicktimeParseAtom(string, integer, string, integer, array, boolean)
#3 /srv/mediawiki/php-1.36.0-wmf.2/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(251): getid3_quicktime->QuicktimeParseContainerAtom(string, integer, array, boolean)
#4 /srv/mediawiki/php-1.36.0-wmf.2/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(74): getid3_quicktime->QuicktimeParseAtom(string, integer, string, integer, array, boolean)
#5 /srv/mediawiki/php-1.36.0-wmf.2/vendor/james-heinrich/getid3/getid3/getid3.php(629): getid3_quicktime->Analyze()
#6 /srv/mediawiki/php-1.36.0-wmf.2/extensions/TimedMediaHandler/includes/handlers/ID3Handler/ID3Handler.php(32): getID3->analyze(string)
#7 /srv/mediawiki/php-1.36.0-wmf.2/extensions/TimedMediaHandler/includes/handlers/Mp4Handler/Mp4Handler.php(12): ID3Handler->getID3(string)
#8 /srv/mediawiki/php-1.36.0-wmf.2/extensions/TimedMediaHandler/includes/handlers/ID3Handler/ID3Handler.php(51): Mp4Handler->getID3(string)
#9 /srv/mediawiki/php-1.36.0-wmf.2/includes/utils/MWFileProps.php(87): ID3Handler->getMetadata(FSFile, string)
#10 /srv/mediawiki/php-1.36.0-wmf.2/includes/upload/UploadBase.php(488): MWFileProps->getPropsFromPath(string, string)
#11 /srv/mediawiki/php-1.36.0-wmf.2/includes/upload/UploadBase.php(390): UploadBase->verifyFile()
#12 /srv/mediawiki/php-1.36.0-wmf.2/includes/api/ApiUpload.php(610): UploadBase->verifyUpload()
#13 /srv/mediawiki/php-1.36.0-wmf.2/includes/api/ApiUpload.php(87): ApiUpload->verifyUpload()
#14 /srv/mediawiki/php-1.36.0-wmf.2/includes/api/ApiMain.php(1593): ApiUpload->execute()
#15 /srv/mediawiki/php-1.36.0-wmf.2/includes/api/ApiMain.php(529): ApiMain->executeAction()
#16 /srv/mediawiki/php-1.36.0-wmf.2/includes/api/ApiMain.php(500): ApiMain->executeActionWithErrorHandling()
#17 /srv/mediawiki/php-1.36.0-wmf.2/api.php(90): ApiMain->execute()
#18 /srv/mediawiki/php-1.36.0-wmf.2/api.php(45): wfApiMain()
#19 /srv/mediawiki/w/api.php(3): require(string)
#20 {main}

Event Timeline

LarsWirzenius triaged this task as Unbreak Now! priority.Aug 4 2020, 8:54 AM

There's also this message: "PHP Warning: implode(): Invalid arguments passed" with the following stack trace:

~~~

	#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)

#1 /srv/mediawiki/php-1.36.0-wmf.2/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(1649): implode(string, boolean)
#2 /srv/mediawiki/php-1.36.0-wmf.2/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(2003): getid3_quicktime->QuicktimeParseAtom(string, integer, string, integer, array, boolean)
#3 /srv/mediawiki/php-1.36.0-wmf.2/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(251): getid3_quicktime->QuicktimeParseContainerAtom(string, integer, array, boolean)
#4 /srv/mediawiki/php-1.36.0-wmf.2/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(74): getid3_quicktime->QuicktimeParseAtom(string, integer, string, integer, array, boolean)
#5 /srv/mediawiki/php-1.36.0-wmf.2/vendor/james-heinrich/getid3/getid3/getid3.php(629): getid3_quicktime->Analyze()
#6 /srv/mediawiki/php-1.36.0-wmf.2/extensions/TimedMediaHandler/includes/handlers/ID3Handler/ID3Handler.php(32): getID3->analyze(string)
#7 /srv/mediawiki/php-1.36.0-wmf.2/extensions/TimedMediaHandler/includes/handlers/Mp4Handler/Mp4Handler.php(12): ID3Handler->getID3(string)
#8 /srv/mediawiki/php-1.36.0-wmf.2/extensions/TimedMediaHandler/includes/handlers/ID3Handler/ID3Handler.php(51): Mp4Handler->getID3(string)
#9 /srv/mediawiki/php-1.36.0-wmf.2/includes/utils/MWFileProps.php(87): ID3Handler->getMetadata(FSFile, string)
#10 /srv/mediawiki/php-1.36.0-wmf.2/includes/upload/UploadBase.php(488): MWFileProps->getPropsFromPath(string, string)
#11 /srv/mediawiki/php-1.36.0-wmf.2/includes/upload/UploadBase.php(390): UploadBase->verifyFile()
#12 /srv/mediawiki/php-1.36.0-wmf.2/includes/api/ApiUpload.php(610): UploadBase->verifyUpload()
#13 /srv/mediawiki/php-1.36.0-wmf.2/includes/api/ApiUpload.php(87): ApiUpload->verifyUpload()
#14 /srv/mediawiki/php-1.36.0-wmf.2/includes/api/ApiMain.php(1593): ApiUpload->execute()
#15 /srv/mediawiki/php-1.36.0-wmf.2/includes/api/ApiMain.php(529): ApiMain->executeAction()
#16 /srv/mediawiki/php-1.36.0-wmf.2/includes/api/ApiMain.php(500): ApiMain->executeActionWithErrorHandling()
#17 /srv/mediawiki/php-1.36.0-wmf.2/api.php(90): ApiMain->execute()
#18 /srv/mediawiki/php-1.36.0-wmf.2/api.php(45): wfApiMain()
#19 /srv/mediawiki/w/api.php(3): require(string)
#20 {main}
~~~

brennen lowered the priority of this task from Unbreak Now! to Needs Triage.Aug 4 2020, 3:48 PM
brennen added a project: User-brennen.
brennen subscribed.

Looks like it goes back as far as 1.35.0-wmf.41:

Screenshot-2020-08-04-09:42:32.png (246×1 px, 21 KB)

...that's as far as I looked, but at any rate it's been happening intermittently for a while. Won't block this train on it, though triage is of course appreciated.

Likely this block:
https://github.com/JamesHeinrich/getID3/blob/953d2f5dce0b9850002aff2a125680c8f35862cb/getid3/module.audio-video.quicktime.php#L1675

//Get the UUID ID in first 16 bytes
					$uuid_bytes_read = unpack('H8time_low/H4time_mid/H4time_hi/H4clock_seq_hi/H12clock_seq_low', substr($atom_data, 0, 16));
					$atom_structure['uuid_field_id'] = implode('-', $uuid_bytes_read);

Either the data in that field is incorrect or the specification of allowed data in ID3 is incorrect.

A few messages showing up in logs for 1.36.0-wmf.4 related to this:

  • ErrorException from line 1682 of /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php: PHP Notice: Undefined offset: 1
  • [{exception_id}] {exception_url} ErrorException from line 1652 of /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php: PHP Warning: unpack(): Type S: not enough input, need 2, have 0
  • [{exception_id}] {exception_url} ErrorException from line 1649 of /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php: PHP Warning: implode(): Invalid arguments passed
  • [{exception_id}] {exception_url} ErrorException from line 1648 of /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php: PHP Warning: unpack(): Type H: not enough input, need 4, have 0

All happening at roughly the same time due to an api call, possibly with misformatted file.

Picked one that happened and filtering on reqId=517afa8d-a805-4346-9cae-aa6bf934d556 there are a few more messages:

/srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php:1649
PHP Warning: implode(): Invalid arguments passed

#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(1649): implode(string, boolean)
#2 /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(2003): getid3_quicktime->QuicktimeParseAtom(string, integer, string, integer, array, boolean)
#3 /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(251): getid3_quicktime->QuicktimeParseContainerAtom(string, integer, array, boolean)
#4 /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(74): getid3_quicktime->QuicktimeParseAtom(string, integer, string, integer, array, boolean)
#5 /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/getid3.php(629): getid3_quicktime->Analyze()
#6 /srv/mediawiki/php-1.36.0-wmf.4/extensions/TimedMediaHandler/includes/handlers/ID3Handler/ID3Handler.php(32): getID3->analyze(string)
#7 /srv/mediawiki/php-1.36.0-wmf.4/extensions/TimedMediaHandler/includes/handlers/Mp4Handler/Mp4Handler.php(12): ID3Handler->getID3(string)
#8 /srv/mediawiki/php-1.36.0-wmf.4/extensions/TimedMediaHandler/includes/handlers/ID3Handler/ID3Handler.php(51): Mp4Handler->getID3(string)
#9 /srv/mediawiki/php-1.36.0-wmf.4/includes/utils/MWFileProps.php(87): ID3Handler->getMetadata(FSFile, string)
#10 /srv/mediawiki/php-1.36.0-wmf.4/includes/upload/UploadBase.php(547): MWFileProps->getPropsFromPath(string, string)
#11 /srv/mediawiki/php-1.36.0-wmf.4/includes/upload/UploadBase.php(482): UploadBase->verifyPartialFile()
#12 /srv/mediawiki/php-1.36.0-wmf.4/includes/upload/UploadBase.php(390): UploadBase->verifyFile()
#13 /srv/mediawiki/php-1.36.0-wmf.4/includes/api/ApiUpload.php(610): UploadBase->verifyUpload()
#14 /srv/mediawiki/php-1.36.0-wmf.4/includes/api/ApiUpload.php(87): ApiUpload->verifyUpload()
#15 /srv/mediawiki/php-1.36.0-wmf.4/includes/api/ApiMain.php(1593): ApiUpload->execute()
#16 /srv/mediawiki/php-1.36.0-wmf.4/includes/api/ApiMain.php(529): ApiMain->executeAction()
#17 /srv/mediawiki/php-1.36.0-wmf.4/includes/api/ApiMain.php(500): ApiMain->executeActionWithErrorHandling()
#18 /srv/mediawiki/php-1.36.0-wmf.4/api.php(90): ApiMain->execute()
#19 /srv/mediawiki/php-1.36.0-wmf.4/api.php(45): wfApiMain()
#20 /srv/mediawiki/w/api.php(3): require(string)
#21 {main}
/srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php:1682
t exception.message 	
PHP Notice: Undefined offset: 1

#0 /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(1682): MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(2003): getid3_quicktime->QuicktimeParseAtom(string, integer, string, integer, array, boolean)
#2 /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(251): getid3_quicktime->QuicktimeParseContainerAtom(string, integer, array, boolean)
#3 /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/module.audio-video.quicktime.php(74): getid3_quicktime->QuicktimeParseAtom(string, integer, string, integer, array, boolean)
#4 /srv/mediawiki/php-1.36.0-wmf.4/vendor/james-heinrich/getid3/getid3/getid3.php(629): getid3_quicktime->Analyze()
#5 /srv/mediawiki/php-1.36.0-wmf.4/extensions/TimedMediaHandler/includes/handlers/ID3Handler/ID3Handler.php(32): getID3->analyze(string)
#6 /srv/mediawiki/php-1.36.0-wmf.4/extensions/TimedMediaHandler/includes/handlers/Mp4Handler/Mp4Handler.php(12): ID3Handler->getID3(string)
#7 /srv/mediawiki/php-1.36.0-wmf.4/extensions/TimedMediaHandler/includes/handlers/ID3Handler/ID3Handler.php(51): Mp4Handler->getID3(string)
#8 /srv/mediawiki/php-1.36.0-wmf.4/includes/utils/MWFileProps.php(87): ID3Handler->getMetadata(FSFile, string)
#9 /srv/mediawiki/php-1.36.0-wmf.4/includes/upload/UploadBase.php(547): MWFileProps->getPropsFromPath(string, string)
#10 /srv/mediawiki/php-1.36.0-wmf.4/includes/upload/UploadBase.php(482): UploadBase->verifyPartialFile()
#11 /srv/mediawiki/php-1.36.0-wmf.4/includes/upload/UploadBase.php(390): UploadBase->verifyFile()
#12 /srv/mediawiki/php-1.36.0-wmf.4/includes/api/ApiUpload.php(610): UploadBase->verifyUpload()
#13 /srv/mediawiki/php-1.36.0-wmf.4/includes/api/ApiUpload.php(87): ApiUpload->verifyUpload()
#14 /srv/mediawiki/php-1.36.0-wmf.4/includes/api/ApiMain.php(1593): ApiUpload->execute()
#15 /srv/mediawiki/php-1.36.0-wmf.4/includes/api/ApiMain.php(529): ApiMain->executeAction()
#16 /srv/mediawiki/php-1.36.0-wmf.4/includes/api/ApiMain.php(500): ApiMain->executeActionWithErrorHandling()
#17 /srv/mediawiki/php-1.36.0-wmf.4/api.php(90): ApiMain->execute()
#18 /srv/mediawiki/php-1.36.0-wmf.4/api.php(45): wfApiMain()
#19 /srv/mediawiki/w/api.php(3): require(string)
#20 {main}

Those are files being uploaded. I would assume they get rejected as part of the verification and thus we don't even have the file available. Possibly we could catch the issue and have the file kept for further analysis, or at least log the faulty metadata.

From upstream:

Issue:
mp4 uuid code fails with unpack(): Type H: not enough input.

https://github.com/JamesHeinrich/getID3/issues/226

From upstream:

Issue:
mp4 uuid code fails with unpack(): Type H: not enough input.

https://github.com/JamesHeinrich/getID3/issues/226

Claimed to be fixed, and released in james-heinrich/getid3 v1.9.20.

We've updated since then in 246ae76f9bbbda0, per https://gerrit.wikimedia.org/r/c/mediawiki/vendor/+/628566 (Thanks @Reedy).

And I no longer see the issue in the past 30 days.

Krinkle assigned this task to Reedy.
Krinkle triaged this task as Medium priority.
Krinkle added a subscriber: Reedy.