Skip to content

Crash while debugging with chrome after rebuild of code #25754

Open
@rogerta

Description

Version: Deno 1.46.1

Crash while debugging with chrome after rebuild of code (see stack trace below)

Repro steps

  1. Start deno app with command: deno serve --inspect --watch --allow-env --allow-read --allow-net --allow-ffi --unstable-ffi --port 9092 src/main.ts.
  2. Use chrome 128.0.6613.119 (Official Build) (64-bit) as debugger. Click the Inspect link in the chrome://inspect/#devices page for the deno remote client to open a DevTools window.
  3. Add a break point and step through the code. All works.
  4. Make a change to the code so that the deno process restarts.
  5. Close the chrome DevTools window and open a new one by clicking the Inspect link again.
  6. Step through the code again.

Expected result
Debug app.

Actual result
deno crashes with the following stack trace:

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.46.1
Args: ["deno", "serve", "--inspect", "--watch", "--allow-env", "--allow-read", "--allow-net", "--allow-ffi", "--unstable-ffi", "--port", "9092", "src/main.ts"]

thread 'main' panicked at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/deno_core-0.306.0/inspector.rs:367:16:
internal error: entered unreachable code
stack backtrace:
   0:     0x5d0e11983635 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hd736fd5964392270
   1:     0x5d0e119b5feb - core::fmt::write::hc6043626647b98ea
   2:     0x5d0e1197d69f - std::io::Write::write_fmt::h0d24b3e0473045db
   3:     0x5d0e1198340e - std::sys_common::backtrace::print::h45eb8174d25a1e76
   4:     0x5d0e11984e79 - std::panicking::default_hook::{{closure}}::haf3f0170eb4f3b53
   5:     0x5d0e11984c1a - std::panicking::default_hook::hb5d3b27aa9f6dcda
   6:     0x5d0e11f7578c - deno::setup_panic_hook::{{closure}}::hcc1c21dbb087ca94
   7:     0x5d0e119854eb - std::panicking::rust_panic_with_hook::h6b49d59f86ee588c
   8:     0x5d0e1198522b - std::panicking::begin_panic_handler::{{closure}}::hd4c2f7ed79b82b70
   9:     0x5d0e11983af9 - std::sys_common::backtrace::__rust_end_short_backtrace::h2946d6d32d7ea1ad
  10:     0x5d0e11984f97 - rust_begin_unwind
  11:     0x5d0e119b2f33 - core::panicking::panic_fmt::ha02418e5cd774672
  12:     0x5d0e119b2fdc - core::panicking::panic::h6c780fb115b2371d
  13:     0x5d0e13b065e5 - deno_core::inspector::JsRuntimeInspector::poll_sessions::h037919d508aeac48
  14:     0x5d0e13c2bbd6 - v8_inspector__V8InspectorClient__BASE__runMessageLoopOnPause
  15:     0x5d0e10f0b678 - _ZN12v8_inspector10V8Debugger18handleProgramBreakEN2v85LocalINS1_7ContextEEENS2_INS1_5ValueEEERKNSt4__Cr6vectorIiNS7_9allocatorIiEEEENS1_4base7EnumSetINS1_5debug11BreakReasonEiEENSG_13ExceptionTypeEb
  16:     0x5d0e10f0b9af - _ZN12v8_inspector10V8Debugger21BreakProgramRequestedEN2v85LocalINS1_7ContextEEERKNSt4__Cr6vectorIiNS5_9allocatorIiEEEENS1_4base7EnumSetINS1_5debug11BreakReasonEiEE
  17:     0x5d0e1044e645 - _ZN2v88internal5Debug12OnDebugBreakENS0_6HandleINS0_10FixedArrayEEENS0_10StepActionENS_4base7EnumSetINS_5debug11BreakReasonEiEE
  18:     0x5d0e1044da20 - _ZN2v88internal5Debug5BreakEPNS0_15JavaScriptFrameENS0_6HandleINS0_10JSFunctionEEE
  19:     0x5d0e10968224 - _ZN2v88internal28Runtime_DebugBreakOnBytecodeEiPmPNS0_7IsolateE
  20:     0x5d0e118232b6 - Builtins_CEntry_Return2_ArgvOnStack_NoBuiltinExit

The code that causes the crash is related to String and regex:

const matches = content.matchAll(/\${{.*?}}/g)  // `content` is a String
for (const m of [...matches].reverse()) {       // <--- crashes when stepping over this line

The command line args --allow-ffi --unstable-ffi are used here because the dependency jsr:@db/sqlite@0.12.0 requires it.

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working correctlyneeds infoneeds further information to be properly triaged

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions