Closed Bug 1383081 Opened 5 years ago Closed 5 years ago

DLC: Close stream before validating checksum


(Firefox for Android Graveyard :: General, defect, P1)



(firefox-esr52 unaffected, firefox54 unaffected, firefox55 fixed, firefox56 fixed)

Firefox 56
Tracking Status
firefox-esr52 --- unaffected
firefox54 --- unaffected
firefox55 --- fixed
firefox56 --- fixed


(Reporter: sebastian, Assigned: sebastian)



(Whiteboard: [MobileAS])


(2 files)

Bug 1261983 introduced a regression: We verify the checksum of downloaded content before the stream is closed now:

This can fail and I saw this fail consistently on my phone after trying to recover from bug 1382596. This should be fixed and uplifted before pushing the new catalog into production.
The good news is that this regression only made it to Beta so far. And looking at historic data in telemetry (See attachment) it luckily didn't affect many clients. There has been a small rise in failures but it's hard to say if this is from this regression. This could heavily depend on Android version and/or device. On the Pixel with Android 8 it's definitely a persistent issue.
Comment on attachment 8889359 [details]
Bug 1383081 - (DLC) DownloadAction: Flush stream before verifying checksum.

Makes sense to me.

I verified `FilterOutputStream.close` (`BufferedOutputStream extends FilterOutputStream`), which used to be called before the checksum, calls flush:
Attachment #8889359 - Flags: review?(michael.l.comella) → review+
Iteration: --- → 1.26
Priority: -- → P1
Whiteboard: [MobileAS]
Pushed by
(DLC) DownloadAction: Flush stream before verifying checksum. r=mcomella
Comment on attachment 8889359 [details]
Bug 1383081 - (DLC) DownloadAction: Flush stream before verifying checksum.

Approval Request Comment

[Feature/Bug causing the regression]: Regression introduced in bug 1261983

[User impact if declined]: Downloading fonts from our downloadable content server might fail. Some websites will render with the default system fonts instead. Websites might look slightly different.

[Is this code covered by automated tests?]: Downloadable content has a good test coverage.

[Has the fix been verified in Nightly?]: I debugged and tested this with a local build. This is very hard to verify in Nightly just by using the app. However we have telemetry for downloadable content and should see a drop in checksum errors.

[Needs manual test from QE? If yes, steps to reproduce]: -

[List of other uplifts needed for the feature/fix]: -

[Is the change risky?]: Very low risk. This patch is making sure that we completely write a file to disk before verifying the checksum.

[Why is the change risky/not risky?]: Very small change. No change of the code flow itself.

[String changes made/needed]: -
Attachment #8889359 - Flags: approval-mozilla-beta?
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 56
Comment on attachment 8889359 [details]
Bug 1383081 - (DLC) DownloadAction: Flush stream before verifying checksum.

fennec regression fix for beta55

should be in 55.0b14 and 55.0rc next week
Attachment #8889359 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
Product: Firefox for Android → Firefox for Android Graveyard
You need to log in before you can comment on or make changes to this bug.