Closed Bug 1434798 Opened 6 years ago Closed 6 years ago

Intermittent browser_ext_tabs_saveAsPDF.js | Uncaught exception - [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFile.createUnique]" nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)"

Categories

(WebExtensions :: Frontend, defect, P5)

defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: intermittent-bug-filer, Unassigned)

References

Details

(Keywords: intermittent-failure)

Summary: Intermittent /browser_ext_tabs_saveAsPDF.js | Uncaught exception - [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFile.createUnique]" nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)" → Intermittent browser_ext_tabs_saveAsPDF.js | Uncaught exception - [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFile.createUnique]" nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)"
Shane,

I am hoping that you may be able to give some insight.

The exception is happening at line 268 in ExtensionTestCommon.jsm, when file.createUnique() tries to create the zip file for the generated extension with the file name "generated-extension.xpi":

> 263  static generateZipFile(files, baseName = "generated-extension.xpi") {
> ...
> 267    let file = FileUtils.getFile("TmpD", [baseName]);
> 268    file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, FileUtils.PERMS_FILE);

It looks as if there is an existing file with this name that is preventing creation of the new zip file.

Since it is the first test in browser_ext_tabs_saveAsPDF.js that fails, I think it is likely that the unexpected existing file was left over from a previous test.

The immediately preceding test (browser_ext_tabs_removeCSS.js) has Javascript errors.

I wonder if this may be causing the problem?
Flags: needinfo?(mixedpuppy)
I don't see any reason the prior test would cause this, nor do I see a reason this should happen.  However a comment in the cleanup[1] indicates a potential race here.  Perhaps Kris can shed some light.

[1] https://searchfox.org/mozilla-central/source/toolkit/components/extensions/Extension.jsm#1606
Flags: needinfo?(mixedpuppy) → needinfo?(kmaglione+bmo)
Luca is looking at other similar bugs...
Flags: needinfo?(lgreco)
Depends on: 1435100
I've just added the other similar intermittent test failure (Bug 1434777) to Bug 1435100.
Flags: needinfo?(lgreco)
Flags: needinfo?(kmaglione+bmo)
There are multiple bugs with NS_ERROR_FILE_ACCESS_DENIED in createUnique:
bug 1399348
bug 1394863

They might be related.


(In reply to Shane Caraveo (:mixedpuppy) from comment #2)
> I don't see any reason the prior test would cause this, nor do I see a
> reason this should happen.  However a comment in the cleanup[1] indicates a
> potential race here.  Perhaps Kris can shed some light.
> 
> [1]
> https://searchfox.org/mozilla-central/source/toolkit/components/extensions/
> Extension.jsm#1606

Permalink: https://searchfox.org/mozilla-central/rev/918ed6c474009d9ea9c49ab8adb52b717c5c8389/toolkit/components/extensions/Extension.jsm#1606

For posterity, the comment is:

    return this.broadcast("Extension:FlushJarCache", {path: file.path}).then(() => {
      // We can't delete this file until everyone using it has
      // closed it (because Windows is dumb). So we wait for all the
      // child processes (including the parent) to flush their JAR
      // caches. These caches may keep the file open.
      file.remove(false);
    }).catch(Cu.reportError);
This intermittent hasn't shown up since February, 23rd. This is the time when bug 1435100 was fixed.

The last test before the error is browser_ext_tabs_removeCSS.js, which means (together with the above observation) that bug 1435100 has fixed this issue.

https://treeherder.mozilla.org/logviewer.html#?repo=mozilla-beta&job_id=163993209&lineNumber=3485
19:09:45     INFO -  613 INFO TEST-OK | browser/components/extensions/test/browser/browser_ext_tabs_removeCSS.js | took 556ms
3478
19:09:45     INFO -  614 INFO checking window state
3479
19:09:45     INFO -  615 INFO TEST-START | browser/components/extensions/test/browser/browser_ext_tabs_saveAsPDF.js
3480
19:09:45     INFO -  TEST-INFO | started process screenshot
3481
19:09:45     INFO -  TEST-INFO | screenshot: exit 0
3482
19:09:45     INFO -  Buffered messages logged at 19:09:45
3483
19:09:45     INFO -  616 INFO Entering test bound testSaveAsPDF_saved
3484
19:09:45     INFO -  Buffered messages finished
3485
19:09:45    ERROR -  617 INFO TEST-UNEXPECTED-FAIL | browser/components/extensions/test/browser/browser_ext_tabs_saveAsPDF.js | Uncaught exception - [Exception... "Component returned failure code: 0x80520015 (NS_ERROR_FILE_ACCESS_DENIED) [nsIFile.createUnique]"  nsresult: "0x80520015 (NS_ERROR_FILE_ACCESS_DENIED)"  location: "JS frame :: resource://testing-common/ExtensionTestCommon.jsm :: generateZipFile :: line 268"  data: no]
3486
Status: NEW → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Product: Toolkit → WebExtensions
You need to log in before you can comment on or make changes to this bug.