Open felix-schindler opened 1 year ago
Smaller reproducible example:
// app.ts
await caches.open('my-cache');
❯ deno compile -Ar app.ts
❯ RUST_BACKTRACE=full ./app 17:31:59
============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.
Platform: linux x86_64
Version: 1.39.2
Args: ["./app"]
thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_core-0.243.0/gotham_state.rs:82:3:
required type deno_cache::CreateCache<deno_cache::sqlite::SqliteBackedCache> is not present in GothamState container
stack backtrace:
0: 0x5648094f3aec - std::backtrace_rs::backtrace::libunwind::trace::ha637c64ce894333a
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
1: 0x5648094f3aec - std::backtrace_rs::backtrace::trace_unsynchronized::h47f62dea28e0c88d
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
2: 0x5648094f3aec - std::sys_common::backtrace::_print_fmt::h9eef0abe20ede486
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:67:5
3: 0x5648094f3aec - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hed7f999df88cc644
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:44:22
4: 0x564809528fa0 - core::fmt::rt::Argument::fmt::h1539a9308b8d058d
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/rt.rs:142:9
5: 0x564809528fa0 - core::fmt::write::h3a39390d8560d9c9
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/mod.rs:1120:17
6: 0x5648094ed8ef - std::io::Write::write_fmt::h5fc9997dfe05f882
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/io/mod.rs:1762:15
7: 0x5648094f38d4 - std::sys_common::backtrace::_print::h894006fb5c6f3d45
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:47:5
8: 0x5648094f38d4 - std::sys_common::backtrace::print::h23a2d212c6fff936
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:34:9
9: 0x5648094f5597 - std::panicking::default_hook::{{closure}}::h8a1d2ee00185001a
10: 0x5648094f52ff - std::panicking::default_hook::h6038f2eba384e475
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:292:9
11: 0x5648099bbfea - deno::setup_panic_hook::{{closure}}::hacc44a02420c7519
12: 0x5648094f5c18 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1f8f335eaa9cfaee
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2021:9
13: 0x5648094f5c18 - std::panicking::rust_panic_with_hook::h2b5517d590cab22e
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:783:13
14: 0x5648094f596e - std::panicking::begin_panic_handler::{{closure}}::h233112c06e0ef43e
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:657:13
15: 0x5648094f3fb6 - std::sys_common::backtrace::__rust_end_short_backtrace::h6e893f24d7ebbff8
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:170:18
16: 0x5648094f56d2 - rust_begin_unwind
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
17: 0x564809526025 - core::panicking::panic_fmt::hbf0e066aabfa482c
at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
18: 0x56480a15e8d2 - deno_core::gotham_state::missing::hdc17e0b5b1bb5488
19: 0x564809ddcb52 - deno_cache::get_cache::h9bb2f2c062ca72c9
20: 0x564809dd96ff - deno_cache::op_cache_storage_open<CA>::call::{{closure}}::hd7ea88e226849057
21: 0x564809dd9cc4 - deno_cache::op_cache_storage_open<CA>::v8_fn_ptr::h068eab352b334d85
22: 0x56480930895d - Builtins_CallApiCallbackGeneric
The problem appears to be that we are using StorageKeyResolver::empty()
in cli/standalone/mod.rs
which disables the cache.
What probably needs to happen here is that we should use the current executing path (aka argv[0]) of the compiled executable as the key. This should fix the cache API.
This will also need an associated test.
General information
The panic occurs when using the
cache
function ofx/hono@v3.1.6/middleware.ts
and only when using the compile command. When running directly, it seems to be working just fine.Rust Backtrace
using Docker (
denoland/deno:alpine
)using macOS