deno icon indicating copy to clipboard operation
deno copied to clipboard

🐛 WinOS/WSL-1 ~ running `deno install` with Deno.Command has errors

Open rivy opened this issue 1 year ago • 0 comments

Version: Deno 1.44.0+, including Deno 2.0+

Under WinOS/WSL-1, executing deno install ... using Deno.Command has errors and takes a very long time to complete.

$ time deno install -Afg https://cdn.jsdelivr.net/gh/rivy/deno.dxx@4a5f3bba/eg/args.ts
✅ Successfully installed args
/home/toor/.deno/bin/args

real    0m0.160s
user    0m0.250s
sys     0m0.125s

$ time deno eval "const c = new Deno.Command('deno', { args: ['install','-Afg','https://cdn.jsdelivr.net/gh/rivy/deno.dxx@4a5f3bba/eg/args.ts'] }); const p = c.spawn(); await p.output();"
Could not initialize cache database '/home/toor/.cache/deno/dep_analysis_cache_v2', deleting and retrying... (locking protocol

Caused by:
    Error code 15: Database lock protocol error)
Failed to open cache file '/home/toor/.cache/deno/dep_analysis_cache_v2', opening in-memory cache.
✅ Successfully installed args
/home/toor/.deno/bin/args

real    0m33.035s
user    0m0.219s
sys     0m0.266s

The change happened when upgrading from 1.43.6 to 1.44.0.

The slow-down and error don't occur in WSL-2.

Maybe just add a simple WSL-1 check and fallback immediately to the in-memory cache for that case? That should fix the error and the majority of speed issue if a further refactor isn't desired.

Alternatively, some flag to avoid the database probe might help as the user could check for WSL-1 and use deno install ... is a more system efficient manner.

rivy avatar Oct 20 '24 20:10 rivy