Page MenuHomePhabricator

DivisionByZeroError: Division by zero
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error
normalized_message
[{reqId}] {exception_url}   DivisionByZeroError: Division by zero
Impact
Notes

See also: T376137: FLAC and MID files display a duration of 0 (zero seconds)

Event Timeline

					$bitrate = round(
						(int)( filesize( $this->getTargetEncodePath() ) / $file->getLength() ) * 8
					);

$file->getLength() is seemingly zero. File is a midi file - https://commons.wikimedia.org/wiki/File:A111A.mid, and almost certainly some copyright violation or something...

A111A.mid (MIDI audio file, length 0.0 s, 0 bps overall, file size: 10 KB)

I have a copy, but I'm going to flag it for deletion as it seems suspect.

But locally is fine to play. VLC reckons 2 mins 40 long.

General
Complete name                            : A111A.mid
Format                                   : MIDI
Format/Info                              : RIFF Musical Instrument Digital Interface
File size                                : 9.55 KiB

Audio
Format                                   : MIDI
Format/Info                              : RIFF Musical Instrument Digital Interface

Code last touched in rETMH3a328183593e: Record transcode errors on early bugouts or exception.

Reedy triaged this task as Low priority.Jan 31 2025, 1:49 PM

Still happening, currently at the top of logspam-watch.

image.png (72×1 px, 19 KB)

(Might all be from the same file, not sure; the file name doesn’t seem to be included in the logstash message. I guess you could kafkacat for the job params based on the request ID.)

@Lucas_Werkmeister_WMDE i did re-enqueue a bunch of failed transcodes last night, so that might be related. See also T414348 where i noticed another problem.

Change #1225597 had a related patch set uploaded (by TheDJ; author: TheDJ):

[mediawiki/extensions/TimedMediaHandler@master] Fix DivisionByZeroError when calculating bitrate

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

Change #1225597 merged by jenkins-bot:

[mediawiki/extensions/TimedMediaHandler@master] Fix DivisionByZeroError when calculating bitrate

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

Jdforrester-WMF assigned this task to TheDJ.
Jdforrester-WMF subscribed.

Partially reverted in https://gerrit.wikimedia.org/r/c/mediawiki/extensions/TimedMediaHandler/+/1229723 but this should still be fixed. We hope.

The last DivisionByZero of this code path was on Jan 23, 2026 @ 21:30:51.475 UTC