Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deno compile code cache seems not working when error thrown during module loading #26976

Closed
felipecrs opened this issue Nov 21, 2024 · 4 comments

Comments

@felipecrs
Copy link

felipecrs commented Nov 21, 2024

Version: Deno 2.1.0

Reproduction:

# clone pkgx
$ cd /tmp
$ git clone https://github.com/pkgxdev/pkgx
$ cd pkgx

# confirm deno is at the right version
$ deno upgrade 2.1.0

# let's cleanup the cache just in case
$ deno clean

# same as "deno task compile", but with --log-level debug
$ deno compile --lock=deno.lock --allow-all --output "$INIT_CWD/pkgx" --log-level debug ./entrypoint.ts

# cache was not supposed to work on first attempt indeed
$ ./pkgx --version 2>&1 | grep cache
DEBUG RS - denort::cache::cache_db:170 - Opening cache /home/felipecrs/.cache/deno/node_analysis_cache_v2...
DEBUG RS - denort::standalone::code_cache:56 - Failed to deserialize code cache: Cache key mismatch
DEBUG RS - denort::cache::cache_db:389 - Created parent directory for cache db.
× unexpected error unversioned developer build
│ Error: unversioned developer build
│     at default (file:///tmp/deno-compile-pkgx-cc/pkgx/src/modes/version.ts:2:9)
│     at default (file:///tmp/deno-compile-pkgx-cc/pkgx/src/app.ts:145:27)
│     at file:///tmp/deno-compile-pkgx-cc/pkgx/entrypoint.ts:59:9
╰─➤ https://github.com/pkgxdev/pkgx/issues/new

# but even on second attempt it still seems to fail
$ ./pkgx --version 2>&1 | grep cache
DEBUG RS - denort::cache::cache_db:170 - Opening cache /home/felipecrs/.cache/deno/node_analysis_cache_v2...
DEBUG RS - denort::standalone::code_cache:56 - Failed to deserialize code cache: Cache key mismatch
× unexpected error unversioned developer build
│ Error: unversioned developer build
│     at default (file:///tmp/deno-compile-pkgx-cc/pkgx/src/modes/version.ts:2:9)
│     at default (file:///tmp/deno-compile-pkgx-cc/pkgx/src/app.ts:145:27)
│     at file:///tmp/deno-compile-pkgx-cc/pkgx/entrypoint.ts:59:9
╰─➤ https://github.com/pkgxdev/pkgx/issues/new
@felipecrs felipecrs changed the title Code cache not working Code cache seems not working Nov 21, 2024
@dsherret dsherret changed the title Code cache seems not working Deno compile code cache seems not working Nov 21, 2024
@dsherret
Copy link
Member

I think what's happening here is its using a code cache from a previous build, but ./pkgx --version 2>&1 is erroring on "unversioned developer build" before it code caches all the modules? If you have a successful run you should see it use the code cache I think.

I'll add the code cache path to the debug logs.

@felipecrs
Copy link
Author

Oh ok, indeed, if I try a working command, code cache seems to be working:

./pkgx --sync 2>&1 | grep cache
DEBUG RS - denort::cache::cache_db:170 - Opening cache /home/felipecrs/.cache/deno/node_analysis_cache_v2...
DEBUG RS - denort::standalone::code_cache:45 - Loaded 216 code cache entries

@dsherret
Copy link
Member

Yeah, it doesn't save the code cache if it errors during module loading. Perhaps there could be a partial save done in some cases, but I'm not sure it's worth the effort.

@dsherret dsherret changed the title Deno compile code cache seems not working Deno compile code cache seems not working when error thrown during module loading Nov 21, 2024
@felipecrs
Copy link
Author

Yeah, probably not worth it. Feel free to close this issue then.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants