Git Product home page Git Product logo

Comments (4)

simolus3 avatar simolus3 commented on July 17, 2024

No idea on what could have caused this yet. Docs say that NoModificationAllowedError may be thrown by the browser then accessing the same OPFS file multiple times. Can you check whether there's anything in your app that may cause two different database instances to be around without first closing the first one?

If opening the same database two times at the same time is indeed the problem here, deleting databases won't fix this. One way to delete all files for a website is to go to about:settings, then "Privacy & Security", then "Manage data..." under "Cookies and Website Data". You can entirely clear all content Firefox has set for a given domain there.
Deleting OPFS files is tricky since they're not listed in Firefox Devtools, but I think pasting this snippet to the console should work if no database instance is currently open:

(async () => {
  let opfsRoot = await navigator.storage.getDirectory();
  let deleted = 0;
  for await (const [key, value] of opfsRoot.entries()) {
    await opfsRoot.removeEntry(key, { recursive: true });
    deleted++;
  }

  console.log(`Done, deleted ${deleted} entries!`);
})()

from drift.

Surio89 avatar Surio89 commented on July 17, 2024

Thanks for the quick answer!

If i run the script in Firefox i receive:
Promise { <state>: "pending" } ​<state>: "rejected" <reason>: DOMException: No modification allowed code: 7 columnNumber: 0 data: null filename: "" lineNumber: 0 message: "No modification allowed" name: "NoModificationAllowedError" result: 2152923143 stack: "" <prototype>: DOMExceptionPrototype { name: Getter, message: Getter, INDEX_SIZE_ERR: 1, … } <prototype>: Promise.prototype { … }

When i run in in another Browser it deletes the db as expected and after a reload the db is recreated and works as expected.

Firefox runs with WasmStorageImplementation.opfsShared and my other Browsers with WasmStorageImplementation.opfsLocks. On another machine the App works fine in Firefox.

from drift.

simolus3 avatar simolus3 commented on July 17, 2024

If the No modification allowed exception happens, your database is currently open somewhere. You could try serving a version of your app once where you never open the database just to check and delete OPFS files, but the problem will likely come back afterwards.

With opfsLocks, each tab uses its own database instance and briefly opens the file only when it needs to read or write it. opsShared is a more efficient mode where we use a shared worker that keeps the database files open all the time and serves requests coming in from all tabs. Since a shared worker is used, it should be impossible to reach that state.
To help me debug this, could you look at about:debugging#workers and see if there are multiple shared workers for your application active? You mentioned that you don't have a way to reproduce this, does the problem not go away after closing your app and re-opening it? Or after deleting data for your app in Firefox settings?

from drift.

Surio89 avatar Surio89 commented on July 17, 2024

I managed to delete the db with the script before the app opens the db.

After a reload i noticed, that the app now runs with WasmStorageImplementation.sharedIndexedDb and i receive:

NotFoundError: IDBDatabase.transaction: 'files' is not a known object store name

error.

Im stuck in this state until i delte the indexed db via dev tools and reload.

After reload im in WasmStorageImplementation.opfsShared mode again and everything works as expected!

The app now works fine from the affected browser. unfortunately I don't know how to reproduce the initial problem. When I had the initial problem, neither reloading nor restarting the browser helped.

If i have an open tab with the app the abount:debugging#workers shows this:

image

If i close the tab the three entries disappear.

from drift.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.