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

Panic on Trying to enabled a feature that is already enabled kv from compiled binary #22015

Closed
prasannavl opened this issue Jan 21, 2024 · 5 comments · Fixed by #24381
Closed
Labels
bug Something isn't working correctly cli related to cli/ dir compile related to the `deno compile` feature

Comments

@prasannavl
Copy link

prasannavl commented Jan 21, 2024

deno --version
deno 1.39.4 (release, x86_64-unknown-linux-gnu)
v8 12.0.267.8
$ RUST_BACKTRACE=full ./emissions-handler-bot 

============================================================
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.4
Args: ["./emissions-handler-bot"]

thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_core-0.245.0/feature_checker.rs:50:5:
Trying to enabled a feature that is already enabled kv
stack backtrace:
   0:     0x55ff1c52385c - std::backtrace_rs::backtrace::libunwind::trace::ha637c64ce894333a
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x55ff1c52385c - std::backtrace_rs::backtrace::trace_unsynchronized::h47f62dea28e0c88d
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x55ff1c52385c - std::sys_common::backtrace::_print_fmt::h9eef0abe20ede486
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x55ff1c52385c - <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:     0x55ff1c559120 - core::fmt::rt::Argument::fmt::h1539a9308b8d058d
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/rt.rs:142:9
   5:     0x55ff1c559120 - core::fmt::write::h3a39390d8560d9c9
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/fmt/mod.rs:1120:17
   6:     0x55ff1c51d63f - std::io::Write::write_fmt::h5fc9997dfe05f882
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/io/mod.rs:1762:15
   7:     0x55ff1c523644 - std::sys_common::backtrace::_print::h894006fb5c6f3d45
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x55ff1c523644 - std::sys_common::backtrace::print::h23a2d212c6fff936
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x55ff1c525307 - std::panicking::default_hook::{{closure}}::h8a1d2ee00185001a
  10:     0x55ff1c52506f - std::panicking::default_hook::h6038f2eba384e475
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:292:9
  11:     0x55ff1c9f8654 - deno::setup_panic_hook::{{closure}}::h616c3ba1f2c73079
  12:     0x55ff1c525988 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::h1f8f335eaa9cfaee
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/alloc/src/boxed.rs:2021:9
  13:     0x55ff1c525988 - std::panicking::rust_panic_with_hook::h2b5517d590cab22e
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:783:13
  14:     0x55ff1c5256de - std::panicking::begin_panic_handler::{{closure}}::h233112c06e0ef43e
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:657:13
  15:     0x55ff1c523d26 - std::sys_common::backtrace::__rust_end_short_backtrace::h6e893f24d7ebbff8
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/sys_common/backtrace.rs:170:18
  16:     0x55ff1c525442 - rust_begin_unwind
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:645:5
  17:     0x55ff1c5561a5 - core::panicking::panic_fmt::hbf0e066aabfa482c
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/panicking.rs:72:14
  18:     0x55ff1e230391 - deno_core::feature_checker::FeatureChecker::enable_feature::hd97fa39c21965ef9
  19:     0x55ff1c9222c0 - deno::standalone::run::{{closure}}::h3c27a2e9c8b612a4
  20:     0x55ff1c7a32f6 - <deno_unsync::task::MaskFutureAsSend<F> as core::future::future::Future>::poll::hea00a835854cd1b4
  21:     0x55ff1c6bf530 - tokio::runtime::task::raw::poll::hc9317a6994197c07
  22:     0x55ff1c9f9b65 - deno::main::h5ecdc3785856ff6f
  23:     0x55ff1c5d4c67 - std::sys_common::backtrace::__rust_begin_short_backtrace::hc7d9457cf7c8eb75
  24:     0x55ff1c5da552 - std::rt::lang_start::{{closure}}::h5fd33d377bc31dcf
  25:     0x55ff1c511c97 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::hd95060ecd5e1ca24
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/core/src/ops/function.rs:284:13
  26:     0x55ff1c511c97 - std::panicking::try::do_call::h6e8cf51db32a6e4b
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
  27:     0x55ff1c511c97 - std::panicking::try::h3a52eefe24fe3c29
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
  28:     0x55ff1c511c97 - std::panic::catch_unwind::h24c28c23c02c3841
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
  29:     0x55ff1c511c97 - std::rt::lang_start_internal::{{closure}}::h705d3c9cbc06ef47
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148:48
  30:     0x55ff1c511c97 - std::panicking::try::do_call::ha21f52ba13158470
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:552:40
  31:     0x55ff1c511c97 - std::panicking::try::h5581346bf6aeb1f8
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panicking.rs:516:19
  32:     0x55ff1c511c97 - std::panic::catch_unwind::h7919645a6b72e25b
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/panic.rs:142:14
  33:     0x55ff1c511c97 - std::rt::lang_start_internal::h12de51168669836e
                               at /rustc/82e1608dfa6e0b5569232559e3d385fea5a93112/library/std/src/rt.rs:148:20
  34:     0x55ff1c5da547 - std::rt::lang_start::h99c44a98263d9028
  35:     0x7f7c1aa280d0 - __libc_start_call_main
                               at ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
  36:     0x7f7c1aa28189 - __libc_start_main_impl
                               at ./csu/../csu/libc-start.c:360:3
  37:     0x55ff1b245029 - _start
  38:                0x0 - <unknown>
[exit: 1]
@prasannavl
Copy link
Author

Workaround: Seems removing --unstable-kv from the compile step seems to resolve this.

Guess it's just not able to handle this assumption at the moment. Not a critical issue, will leave it open for a bit to document / consider it this is worth fixing.

@bartlomieju
Copy link
Member

Hey @prasannavl thanks for the report. I tried to reproduce the problem by running deno task build and ./emissions-handler-bot and I'm not enable to reproduce the problem.

Could you try to boil down the reproduction?

@bartlomieju bartlomieju added bug Something isn't working correctly needs info needs further information to be properly triaged labels Jan 21, 2024
@melbourne2991
Copy link

My understanding is:

Given:

{
  "tasks": {
    "compile": "deno compile --unstable-kv main.ts --output out"
  }
}
  1. Run compile, which outputs the out binary
  2. Run ./out --unstable-kv

-Panic-

I was able to repro this way.
I suppose it's because the flag has already been applied in the compiled file.

I'm not sure what the expected behavior should be here though...

@rojvv
Copy link
Contributor

rojvv commented Apr 10, 2024

I get this issue as well in compile time if I have "unstable": ["kv"] in the config and --unstable-kv in the deno compile call.

@lucacasonato lucacasonato added cli related to cli/ dir compile related to the `deno compile` feature and removed needs info needs further information to be properly triaged labels Jun 11, 2024
@HasanAlrimawi
Copy link
Contributor

Hi @lucacasonato ,
I'd like to try solving this issue if it's still available.
I expect that the approach should be to ignore repetitive occurrences of some unstable feature (e.g. kv, kv) and deal with it as one without panic (kv) while maintaining the support for multiple different unstable features, is that the case?

zebreus pushed a commit to zebreus/deno that referenced this issue Jul 8, 2024
Prevent panic when enabling a feature that is already enabled by
removing duplicate features.

Closes denoland#22015

---------

Co-authored-by: Bartek Iwańczuk <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly cli related to cli/ dir compile related to the `deno compile` feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants