Closed Bug 1377260 Opened 5 years ago Closed 5 years ago

Error with .getFilesAndDirectories when directory contents are changing, or filesystem_commons.js needs to be updated


(Core :: DOM: Core & HTML, defect)

Not set



Tracking Status
firefox56 --- fixed


(Reporter: benjamin, Assigned: baku)




(1 file)

I introduced an orange in test_worker_basic.html by changing something entirely unrelated. I landed bug 981818 which causes us to save modified prefs soon after they are changed (instead of only at shutdown).

This caused test_worker_basic.html to fail hitting this line:

Because the error was pretty uninformative, I added some additional debugging, and the actual failure is:
22:44:19     INFO - TEST-UNEXPECTED-FAIL | dom/filesystem/tests/test_worker_basic.html | Something went wrong with .getFilesAndDirectories: [Exception... "File error: Not found"  nsresult: "0x80520012 (NS_ERROR_FILE_NOT_FOUND)"  location: "<unknown>"  data: no] 

My theory about this failure is that this test is calling .getFilesAndDirectories on the profile directory, and racing with a pref save. Saving prefs uses the safe file stream, which writes a temporary file (e.g. "prefs.js.tmp13487") and then renames the temporary file atomically over prefs.js. So if you enumerate the files while the temp file exists and then it doesn't exist later, that would throw an error.

Unfortunately I can't reproduce the problem locally, probably due to differences in disk/CPU speed or test setup that make the race less likely.

So a couple questions:
1) is it normal/ok for .getFilesAndDirectories to reject its promise if there are operations happening while its running?
2) should I try and change this test to e.g. use a different directory?
Flags: needinfo?(amarchesini)
> 2) should I try and change this test to e.g. use a different directory?

I just sent a patch with this approach: bug 1360320.

But, at the same time, we should decide what the API should do if the directory changes. Let's keep this bug for a more global approach.
Flags: needinfo?(amarchesini)
Attached patch fs_change.patchSplinter Review
Assignee: nobody → amarchesini
Attachment #8882408 - Flags: review?(bugs)
Attachment #8882408 - Flags: review?(bugs) → review+
Pushed by
Entries API must return results also when the underlying files of a directory change, r=smaug
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla56
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.