Closed Bug 1369294 Opened 7 years ago Closed 6 years ago

Telemetry Experiments should reccover from invalid experiments.json file

Categories

(Toolkit :: Telemetry, enhancement, P3)

enhancement

Tracking

()

RESOLVED WONTFIX

People

(Reporter: gfritzsche, Unassigned, Mentored)

Details

(Whiteboard: [lang=js])

When replacing $ProfileDir/experiments.json with e.g. a plain text file, we get this error in the browser console:

> ERROR	Experiments #0::_main caught error: Error: uncaught exception: Buffer is too short (no header) - Data: /Users/gfritzsche/Library/Application Support/Firefox/Profiles/2o6dvekw.default/experiments.json

From looking at the loading paths, it seems like we don't have proper recovery for those scenarios:
https://dxr.mozilla.org/mozilla-central/rev/7b8937970f9ca85db88cb2496f2112175fd847c8/browser/experiments/Experiments.jsm#402
https://dxr.mozilla.org/mozilla-central/rev/7b8937970f9ca85db88cb2496f2112175fd847c8/browser/experiments/Experiments.jsm#787

We should make sure that:
- _run()/_main() is triggered regardless of loading success
- _run()/_main() continue operation as if no cache file is present
- we overwrite the experiments.json cache file by marking this._dirty
- uninit(), getExperiments(), setExperimentBranch(), getExperimentBranch() finish properly despite load exceptions
The easiest solution seems to be to make `_loadFromCache()` handle all exceptions gracefully and not leak exceptions.

We should make sure that we have test coverage for this, presumably in this test file:
https://dxr.mozilla.org/mozilla-central/source/browser/experiments/test/xpcshell/test_cache.js
Hi :) 
I wanted to work on it, but it seems like you solved the issue in https://hg.mozilla.org/mozilla-central/log?rev=385175%3A934f0c1076f577a1dd90de3be7b5917b8ba8cfaf

Can you confirm this issue is a duplicate of https://bugzilla.mozilla.org/show_bug.cgi?id=1402609 ? 

I'll find an other bug to tackle if it's the case :)
This is not the same issue, but I think we can probably defer/close this due to bug 1415284. What do you think, Georg?
Flags: needinfo?(gfritzsche)
Agreed - Experiments are going away, let's focus our efforts elsewhere.
Status: NEW → RESOLVED
Closed: 6 years ago
Flags: needinfo?(gfritzsche)
Resolution: --- → WONTFIX
You need to log in before you can comment on or make changes to this bug.