denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
96.54k stars 5.33k forks source link

Deno cache database errors when on a shared drive #24330

Open Sembiance opened 3 months ago

Sembiance commented 3 months ago

I upgraded deno from 1.43.6 to 1.44.4 on my Linux system and ever since I've been getting errors:

Could not initialize cache database '/mnt/compendium/.deno/v8_code_cache_v2', deleting and retrying... (disk I/O error

Caused by:
    Error code 522: Unable to obtain number of requested bytes (file truncated?))
Could not initialize cache database '/mnt/compendium/.deno/dep_analysis_cache_v2', deleting and retrying... (disk I/O error

Caused by:
    Error code 522: Unable to obtain number of requested bytes (file truncated?))
Failed to open cache file '/mnt/compendium/.deno/v8_code_cache_v2', performance may be degraded.
Failed to open cache file '/mnt/compendium/.deno/dep_analysis_cache_v2', opening in-memory cache.```

I always launch deno with: `DENO_DIR=/mnt/compendium/.deno DENO_NO_UPDATE_CHECK=1 DENO_NO_PACKAGE_JSON=1 deno run ...

/mnt/compendium/.deno is on a NFS drive shared between 2 systems, each with the same version of deno, running deno scripts periodically.

If I delete the .deno dir and have it re-create it, the errors go away for a few hours, maybe half a day or so, then come back again.

The NFS mount is fine, as is the hard drive, this only started happening with the latest deno upgrade.

Maybe something was introduced into deno where it tries to do some sort of atomic operations on the cache file database that breaks if said cache is shared between systems on a shared drive where multiple deno processes from different systems may try and modify it at the same time?

Let me know if you want me to run any additional commands, gather any additional info.

Sembiance commented 3 months ago

I can confirm that when this happens the files DO exist. What also has appeared is some .nfs# files, so it sounds like maybe a deno process on one system had these files open when a deno process on the other system tried to truncate or delete them?

Here is what 's in the dir:

sembiance@hostname /mnt/compendium/.deno $ ls -al
total 45120
drwxr-xr-x  8 sembiance sembiance     4096 Jun 26 08:03 .
drwxr-xr-x 18 sembiance users         4096 Jun 25 08:50 ..
-rw-r--r--  1 sembiance sembiance 20815872 Jun 26 08:02 .nfs00000000125d883700000002
-rw-r--r--  1 sembiance sembiance 12594872 Jun 26 08:02 .nfs00000000125d883a00000003
-rw-r--r--  1 sembiance sembiance  6402512 Jun 26 08:02 .nfs00000000125d883b00000004
-rw-r--r--  1 sembiance sembiance  6164480 Jun 26 08:02 .nfs00000000125d8bef00000001
drwxr-xr-x  2 sembiance sembiance     4096 May 24 20:05 bin
-rw-r--r--  1 sembiance sembiance     4096 Jun 26 08:03 dep_analysis_cache_v2
-rw-r--r--  1 sembiance sembiance    32768 Jun 26 08:03 dep_analysis_cache_v2-shm
-rw-r--r--  1 sembiance sembiance        0 Jun 26 08:00 dep_analysis_cache_v2-wal
drwxr-xr-x  3 sembiance sembiance     4096 Jun 25 08:50 deps
drwxr-xr-x  4 sembiance sembiance     4096 Jun 25 19:47 gen
-rw-r--r--  1 sembiance sembiance    20480 Jun 25 09:37 node_analysis_cache_v2
-rw-r--r--  1 sembiance sembiance    32768 Jun 26 07:41 node_analysis_cache_v2-shm
-rw-r--r--  1 sembiance sembiance    41232 Jun 25 08:50 node_analysis_cache_v2-wal
drwxr-xr-x  2 sembiance sembiance     4096 Jun 25 08:50 npm
drwxr-xr-x  3 sembiance sembiance     4096 Jun 25 19:47 plug
drwxr-xr-x  3 sembiance sembiance     4096 Jun 25 09:07 registries
-rw-r--r--  1 sembiance sembiance     4096 Jun 26 08:03 v8_code_cache_v2
-rw-r--r--  1 sembiance sembiance    32768 Jun 26 08:03 v8_code_cache_v2-shm