SQLite Forum

WASM oo1.DB('file:my.db?vfs=opfs','c');
Login

WASM oo1.DB('file:my.db?vfs=opfs','c');

(1) By Don (coduspocus) on 2023-07-30 23:39:37 [link] [source]

I'm not sure if this is an issue with sqlite webassembly or the new firefox-dev but I have a study pwa app I'm developing at: app.kumaflash.com 
there's an really rough overview of it at youtube.com/@kumaflash

It uses sqlite with vfs=opfs for the embedded db.  It's been working well for me aside from opfs being pretty slow.  I recently updated my firefox-dev version to 116.0b8 and now when I try to initialize the db with oo1.DB(...) I get this error:

OPFS syncer: xRead() async error: GetSyncHandleError: Error getting sync handle for xRead(). 6 attempts failed. kumaflash.db : NotFoundError: Entry not found


This doesn't happen in chromium or release firefox though.

The debugger in firefox-dev also keeps crashing so I'm having a hard time tracing the actual issue.

Does anyone have any idea on what I should try next?  Does it sound like a firefox only issue I should report there?

Thanks

(2) By Stephan Beal (stephan) on 2023-07-31 06:32:57 in reply to 1 [link] [source]

Does it sound like a firefox only issue I should report there?

If it's only failing in that particular version, it's a good bet it's a bug in that browser.

It's been working well for me aside from opfs being pretty slow.

That's also been my experience on Firefox :(. Chrome's OPFS is significantly faster. We will have a new alternative OPFS VFS in 3.43 which is several times faster than the current one at the cost of a complete lack of concurrency.

(3) By Roy Hashimoto (rhashimoto) on 2023-08-02 05:40:55 in reply to 1 [link] [source]

NotFoundError: Entry not found

I just saw this happen in my own use of OPFS (i.e. not with SQLite WASM) on Firefox stable (116.0) on macOS. It would have been trying to open files that already exist, but it kept saying not found. Refreshing the page didn't fix it. Restarting Firefox didn't fix it.

I ran a program that used a different OPFS directory in another tab that worked fine. Returned to the original program and still saw the same problem.

Finally I deleted everything in OPFS from the JS console with something like:

(async function() {
  const d = await navigator.storage.getDirectory();
  for await (const [name] of d) await d.removeEntry(name, { recursive: true });
})();

After that it worked fine and I haven't been able to reproduce it. I was actively using the debugger when it started, and I have a theory that when I refreshed the page while stopped at a breakpoint something in OPFS was left in an inconsistent state that manifests as directory corruption.

So anecdotally:

  • I saw something quite similar on Firefox stable.
  • It wasn't related to the SQLite WASM library.
  • Possibly triggered by dev tools use.
  • Disappeared after wiping OPFS.

(4) By charris on 2023-08-08 12:02:58 in reply to 1 [source]

I'm also seeing a similar error in the latest stable Firefox (116.0.2).

Wiping everything in OPFS didn't have any effect. (I also tried disabling Firefox's "enhanced tracking protection" feature for the site in case that was related--no effect).