dyedgreen / deno-sqlite

Deno SQLite module
https://deno.land/x/sqlite
MIT License
409 stars 36 forks source link

can't remove journal #201

Closed ralyodio closed 2 years ago

ralyodio commented 2 years ago

Looks like some internal code is trying to remove a file that doesn't exist:

error: Uncaught (in promise) NotFound: No such file or directory (os error 2), remove 'database.sqlite-journal'
      Deno.removeSync(path);
ralyodio commented 2 years ago
error: Uncaught (in promise) NotFound: No such file or directory (os error 2), remove 'database.sqlite-journal'
      Deno.removeSync(path);
           ^
    at Object.opSync (deno:core/01_core.js:172:12)
    at Object.removeSync (deno:runtime/js/30_fs.js:150:10)
    at js_delete (https://deno.land/x/sqlite@v3.4.0/build/vfs.js:39:12)
    at denoDelete (wasm://wasm/002a4c4a:1:3036)
    at pager_end_transaction (wasm://wasm/002a4c4a:1:37798)
    at sqlite3BtreeCommitPhaseTwo (wasm://wasm/002a4c4a:1:28832)
    at sqlite3VdbeHalt (wasm://wasm/002a4c4a:1:45083)
    at sqlite3VdbeExec (wasm://wasm/002a4c4a:1:55654)
    at sqlite3_step (wasm://wasm/002a4c4a:1:53139)
    at step (wasm://wasm/002a4c4a:1:4377)
dyedgreen commented 2 years ago

Do you have a minimal example to reproduce the issue?

dyedgreen commented 2 years ago

Closing, since I could not reproduce the issue locally.

CreatCodeBuild commented 1 year ago

I encouter this issue as well. It's quite often to reproduce, but not deterministic. @dyedgreen

Mutefish0 commented 1 year ago

I encouter this issue as well. It's quite often to reproduce, but not deterministic. @dyedgreen

+1

dpclark4 commented 1 year ago

I have also seen this issue a few times, but I am unable to reproduce it. When doing back to back inserts, I first see

No such file or directory (os error 2): remove '<mydbname>.db-journal'
    at Object.removeSync (ext:deno_fs/30_fs.js:197:7)
    at js_delete (https://deno.land/x/sqlite@v3.7.2/build/vfs.js:39:12)
    at <anonymous> (wasm://wasm/0027cea2:1:5584)
    at <anonymous> (wasm://wasm/0027cea2:1:86601)
    at <anonymous> (wasm://wasm/0027cea2:1:77100)
    at <anonymous> (wasm://wasm/0027cea2:1:173629)
    at <anonymous> (wasm://wasm/0027cea2:1:92188)
    at <anonymous> (wasm://wasm/0027cea2:1:63017)
    at <anonymous> (wasm://wasm/0027cea2:1:28077)
    at <anonymous> (wasm://wasm/0027cea2:1:114672) {
  name: "NotFound",
  code: "ENOENT"

followed by

RuntimeError: memory access out of bounds
    at <anonymous> (wasm://wasm/0027cea2:1:87936)
    at <anonymous> (wasm://wasm/0027cea2:1:176457)
    at <anonymous> (wasm://wasm/0027cea2:1:63257)
    at <anonymous> (wasm://wasm/0027cea2:1:28077)
    at <anonymous> (wasm://wasm/0027cea2:1:114672)
    at <anonymous> (wasm://wasm/0027cea2:1:4218)
    at <anonymous> (wasm://wasm/0027cea2:1:602494)
    at https://deno.land/x/sqlite@v3.7.2/src/db.ts:399:27
    at setStr (https://deno.land/x/sqlite@v3.7.2/src/wasm.ts:19:20)
    at DB.execute (https://deno.land/x/sqlite@v3.7.2/src/db.ts:396:20)

After this, the inserts appear to succeed but nothing is actually persisted to the database.

I see two issues that might be related: https://github.com/dyedgreen/deno-sqlite/issues/143 and https://github.com/dyedgreen/deno-sqlite/issues/149. Would running with --unstable potentially fix this? It looks like the file locking api might still be unstable https://deno.land/api@v1.36.0?unstable&s=Deno.flock