Closed Bug 1377260 Opened 5 years ago Closed 5 years ago
Error with .get
Files And Directories when directory contents are changing, or filesystem _commons .js needs to be updated
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: https://dxr.mozilla.org/mozilla-central/rev/9af23c413a1f8d337b19b4f8450e241e91b71136/dom/filesystem/tests/filesystem_commons.js#68 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?
> 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.
Assignee: nobody → amarchesini
Attachment #8882408 - Flags: review?(bugs)
Attachment #8882408 - Flags: review?(bugs) → review+
Pushed by email@example.com: https://hg.mozilla.org/integration/mozilla-inbound/rev/006ce2d73568 Entries API must return results also when the underlying files of a directory change, r=smaug
You need to log in before you can comment on or make changes to this bug.