Closed Bug 496063 Opened 15 years ago Closed 15 years ago

Infinite loop entered when shutting down a video during a seek operation

Categories

(Core :: Audio/Video, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.2a1

People

(Reporter: cajbir, Assigned: cajbir)

References

Details

(Keywords: fixed1.9.1)

Attachments

(1 file)

When shutting down during a mochitest run the browser entered an infinite loop. Debugging showed the the decoder thread was spinning in the do/while in liboggz file oggz_seek.c lines 771-774:

  do {
    offset_at = oggz_get_prev_start_page (oggz, og, &granule_at, &serialno);
    unit_at = oggz_get_unit (oggz, serialno, granule_at);
  } while (unit_at > unit_target);

oggz_get_prev_start_page returns -1 (via calling out media stream code which bails out with the error when noticing we're closed/shutting down). The result stored in offset_at is not checked and the loop never exits.

The oggz_get_unit call does no file i/o and operates on the current granule position, which hasn't changed due to the previous error.

This may be the cause of bug 471085.
Assignee: nobody → chris.double
Attached patch FixSplinter Review
Attachment #381221 - Flags: review?(chris)
Attachment #381221 - Flags: review?(chris) → review+
Comment on attachment 381221 [details] [diff] [review]
Fix


>@@ -476,16 +476,18 @@ oggz_scan_for_page (OGGZ * oggz, ogg_page * og, ogg_int64_t unit_target,
>       do {
>         offset_at = oggz_get_prev_start_page(oggz, og, &granule_at, &serialno);
>+	if (offset_at < 0)
>+	  break;
>         unit_at = oggz_get_unit(oggz, serialno, granule_at);
>       } while (unit_at > unit_target);
>       return offset_at;

Nit: Use spaces not tabs.

Otherwise looks good!
I think we should have this in 1.9.1. It fixes an infinite loop which causes 100% cpu usage in a background thread and can cause shutdown hangs.
Flags: wanted1.9.1?
Blocks: 471085
Flags: blocking1.9.1?
Comment on attachment 381221 [details] [diff] [review]
Fix

a191=beltzner
Attachment #381221 - Flags: approval1.9.1+
Flags: wanted1.9.1?
Flags: blocking1.9.1?
Flags: blocking1.9.1+
Whiteboard: [needs landing]
http://hg.mozilla.org/mozilla-central/rev/ad31c4f61407
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Whiteboard: [needs landing] → [needs 191 landing]
Chris, do you have a testcase for this bug? Or will all video files work to reproduce this issue?
Target Milestone: --- → mozilla1.9.2a1
No testcase, sorry. The shutdown has to occur while the decoder is at a specific point in the code during a seek operation. I was lucky to hit it while doing other things and had a debugger handy to track it down.
Applied in upstream liboggz commit 412768eb6b05ca57664c70d2728e491b3c31590f
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: