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

fix: upgrade deno_ast related crates #23187

Merged
merged 57 commits into from
Apr 11, 2024

Conversation

@dsherret dsherret requested a review from bartlomieju April 2, 2024 19:31
Cargo.lock Outdated Show resolved Hide resolved
Comment on lines +169 to +175
let source_map = if options.inline_source_map {
SourceMapOption::Inline
} else if options.source_map {
SourceMapOption::Separate
} else {
SourceMapOption::None
};
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, the source map settings were so confusing...

cli/args/mod.rs Outdated Show resolved Hide resolved
@@ -159,6 +168,7 @@ pub async fn doc(flags: Flags, doc_flags: DocFlags) -> Result<(), AnyError> {
kind_with_drilldown:
deno_doc::html::DocNodeKindWithDrilldown::Other(node.kind),
inner: std::sync::Arc::new(node),
drilldown_parent_kind: None,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure about this one. @crowlKats ?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, thats correct

tests/testdata/coverage/complex_expected.lcov Show resolved Hide resolved
@littledivy
Copy link
Member

littledivy commented Apr 4, 2024

Not able to reproduce the crash locally on Linux.

I sshed into the runner. Here's the stack trace & output:

frame #1: 0x00007ffff7c42476 libc.so.6`raise + 22
libc.so.6`raise:
->  0x7ffff7c42476 <+22>: testl  %eax, %eax
    0x7ffff7c42478 <+24>: jne    0x7ffff7c42480            ; <+32>
    0x7ffff7c4247a <+26>: popq   %rbp
    0x7ffff7c4247b <+27>: retq
(lldb) up
frame #2: 0x00007ffff7c287f3 libc.so.6`abort + 211
libc.so.6`abort:
->  0x7ffff7c287f3 <+211>: movq   %fs:0x10, %rbx
    0x7ffff7c287fc <+220>: cmpq   %rbx, 0x1f3695(%rip)
    0x7ffff7c28803 <+227>: je     0x7ffff7c28825            ; <+261>
    0x7ffff7c28805 <+229>: xorl   %eax, %eax
(lldb) up
frame #3: 0x000055555938edd7 deno`std::sys::unix::abort_internal::h65c316bb00fe1f50 at mod.rs:375:14
(lldb) up
frame #4: 0x0000555559382457 deno`std::process::abort::h27b32eaef07bb5f6 at process.rs:2279:5
(lldb) up
frame #5: 0x00005555593927de deno`std::alloc::rust_oom::h483641ab8405e15e at alloc.rs:369:5
(lldb) up
This version of LLDB has no plugin for the language "rust". Inspection of frame variables will be limited.
frame #6: 0x00005555593927f0 deno`__rg_oom at alloc.rs:364:1
(lldb) up
frame #7: 0x0000555559953ff6 deno`__rust_alloc_error_handler + 6
deno`_$LT$core..iter..adapters..map..Map$LT$I$C$F$GT$$u20$as$u20$core..iter..traits..iterator..Iterator$GT$::fold::hede7e83203d2577d:
->  0x555559953ff6 <+0>: movq   %rdx, %rax
    0x555559953ff9 <+3>: cmpq   %rsi, %rdi
    0x555559953ffc <+6>: je     0x555559954018            ; <+34>
    0x555559953ffe <+8>: subq   %rdi, %rsi
(lldb) up
frame #8: 0x00005555593abf20 deno`alloc::alloc::handle_alloc_error::h81706c48453a6249 [inlined] alloc::alloc::handle_alloc_error::rt_error::h826545dd787b5b0f at alloc.rs:383:13
(lldb) up
frame #9: 0x00005555593abf14 deno`alloc::alloc::handle_alloc_error::h81706c48453a6249 at alloc.rs:389:9
(lldb) up
frame #10: 0x000055555b1514ab deno`alloc::raw_vec::RawVec$LT$T$C$A$GT$::allocate_in::h7eedd6f99a3d16da + 99
deno`alloc::raw_vec::RawVec$LT$T$C$A$GT$::allocate_in::h806a442beb586ae9:
->  0x55555b1514ab <+0>: pushq  %r14
    0x55555b1514ad <+2>: pushq  %rbx
    0x55555b1514ae <+3>: pushq  %rax
    0x55555b1514af <+4>: movq   %rdi, %rbx
(lldb) up
frame #11: 0x000055555aff1b02 deno`_$LT$swc_ecma_transforms_proposal..decorator_2022_03..Decorator202203$u20$as$u20$swc_ecma_visit..VisitMut$GT$::visit_mut_stmts::hcae36f60d3b1c232 + 190
deno`_$LT$swc_ecma_transforms_proposal..decorator_2022_03..Decorator202203$u20$as$u20$swc_ecma_visit..VisitMut$GT$::visit_mut_stmts::hcae36f60d3b1c232:
->  0x55555aff1b02 <+190>: leaq   0x128(%r14), %rcx
    0x55555aff1b09 <+197>: movq   %rcx, 0x50(%rsp)
    0x55555aff1b0e <+202>: movq   %rax, 0x38(%rsp)
    0x55555aff1b13 <+207>: movq   %rdx, 0x40(%rsp)
(lldb) up
frame #12: 0x000055555aff1c09 deno`_$LT$swc_ecma_transforms_proposal..decorator_2022_03..Decorator202203$u20$as$u20$swc_ecma_visit..VisitMut$GT$::visit_mut_stmts::hcae36f60d3b1c232 + 453
deno`_$LT$swc_ecma_transforms_proposal..decorator_2022_03..Decorator202203$u20$as$u20$swc_ecma_visit..VisitMut$GT$::visit_mut_stmts::hcae36f60d3b1c232:
->  0x55555aff1c09 <+453>: cmpq   $0x0, 0x28(%r14)
    0x55555aff1c0e <+458>: je     0x55555aff1c8a            ; <+582>
    0x55555aff1c10 <+460>: movq   0x58(%rsp), %rcx
    0x55555aff1c15 <+465>: movq   0x10(%rcx), %rax
(lldb) up
frame #13: 0x000055555afdd702 deno`swc_ecma_visit::visit_mut_expr_or_spreads::hdc231f523c541c43 + 37
deno`swc_ecma_visit::visit_mut_expr_or_spreads::hdc231f523c541c43:
->  0x55555afdd702 <+37>: movq   %r15, %rsi
    0x55555afdd705 <+40>: addq   $-0x18, %r14
    0x55555afdd709 <+44>: jne    0x55555afdd6f6            ; <+25>
    0x55555afdd70b <+46>: popq   %rbx
(lldb) up
frame #14: 0x000055555aff1c09 deno`_$LT$swc_ecma_transforms_proposal..decorator_2022_03..Decorator202203$u20$as$u20$swc_ecma_visit..VisitMut$GT$::visit_mut_stmts::hcae36f60d3b1c232 + 453
deno`_$LT$swc_ecma_transforms_proposal..decorator_2022_03..Decorator202203$u20$as$u20$swc_ecma_visit..VisitMut$GT$::visit_mut_stmts::hcae36f60d3b1c232:
->  0x55555aff1c09 <+453>: cmpq   $0x0, 0x28(%r14)
    0x55555aff1c0e <+458>: je     0x55555aff1c8a            ; <+582>
    0x55555aff1c10 <+460>: movq   0x58(%rsp), %rcx
    0x55555aff1c15 <+465>: movq   0x10(%rcx), %rax
(lldb) up
frame #15: 0x000055555aff0fb8 deno`_$LT$swc_ecma_transforms_proposal..decorator_2022_03..Decorator202203$u20$as$u20$swc_ecma_visit..VisitMut$GT$::visit_mut_module_items::hbdeaf89632dc8472 + 987
deno`_$LT$swc_ecma_transforms_proposal..decorator_2022_03..Decorator202203$u20$as$u20$swc_ecma_visit..VisitMut$GT$::visit_mut_module_items::hbdeaf89632dc8472:
->  0x55555aff0fb8 <+987>:  jmp    0x55555aff0de2            ; <+517>
    0x55555aff0fbd <+992>:  movq   0x18(%rsp), %rax
    0x55555aff0fc2 <+997>:  testq  %rax, %rax
    0x55555aff0fc5 <+1000>: je     0x55555aff10e7            ; <+1290>
runner@runner:~/work/deno/deno$ target/release/deno run -A ext/websocket/autobahn/fuzzingclient.js
memory allocation of 1314431791570856 bytes failed
Aborted (core dumped)

The OOM is invoked. This looks like a memory bug in swc_ecma_transforms_proposal

@littledivy
Copy link
Member

Also hitting the Vec capacity overflow sometimes:


============================================================
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.42.1
Args: ["target/release/deno", "run", "-A", "ext/websocket/autobahn/fuzzingclient.js"]

thread 'main' panicked at library/alloc/src/raw_vec.rs:571:5:
capacity overflow
stack backtrace:
   0:     0x559596ab1216 - std::backtrace_rs::backtrace::libunwind::trace::hbee8a7973eeb6c93
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x559596ab1216 - std::backtrace_rs::backtrace::trace_unsynchronized::hc8ac75eea3aa6899
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x559596ab1216 - std::sys_common::backtrace::_print_fmt::hc7f3e3b5298b1083
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:68:5
   3:     0x559596ab1216 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hbb235daedd7c6190
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x559596ae5e90 - core::fmt::rt::Argument::fmt::h76c38a80d925a410
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/rt.rs:142:9
   5:     0x559596ae5e90 - core::fmt::write::h3ed6aeaa977c8e45
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/fmt/mod.rs:1120:17
   6:     0x559596aaaf2f - std::io::Write::write_fmt::h78b18af5775fedb5
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/io/mod.rs:1810:15
   7:     0x559596ab0ff4 - std::sys_common::backtrace::_print::h5d645a07e0fcfdbb
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x559596ab0ff4 - std::sys_common::backtrace::print::h85035a511aafe7a8
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x559596ab2d67 - std::panicking::default_hook::{{closure}}::hcce8cea212785a25
  10:     0x559596ab2ac9 - std::panicking::default_hook::hf5fcb0f213fe709a
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:292:9
  11:     0x559596fe1702 - deno::setup_panic_hook::{{closure}}::h7db9972db8f7e5ae
  12:     0x559596ab33f6 - <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call::hbc5ccf4eb663e1e5
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/boxed.rs:2029:9
  13:     0x559596ab33f6 - std::panicking::rust_panic_with_hook::h095fccf1dc9379ee
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:783:13
  14:     0x559596ab3109 - std::panicking::begin_panic_handler::{{closure}}::h032ba12139b353db
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:649:13
  15:     0x559596ab1716 - std::sys_common::backtrace::__rust_end_short_backtrace::h9259bc2ff8fd0f76
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/sys_common/backtrace.rs:171:18
  16:     0x559596ab2ea0 - rust_begin_unwind
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:645:5
  17:     0x559596ae2f25 - core::panicking::panic_fmt::h784f20a50eaab275
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/panicking.rs:72:14
  18:     0x559596ad8f0f - alloc::raw_vec::capacity_overflow::hefb917d2eb4d2968
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/alloc/src/raw_vec.rs:571:5
  19:     0x55959887e49f - alloc::raw_vec::RawVec<T,A>::allocate_in::h7eedd6f99a3d16da
  20:     0x55959871eb02 - <swc_ecma_transforms_proposal::decorator_2022_03::Decorator202203 as swc_ecma_visit::VisitMut>::visit_mut_stmts::hcae36f60d3b1c232
  21:     0x55959871ec09 - <swc_ecma_transforms_proposal::decorator_2022_03::Decorator202203 as swc_ecma_visit::VisitMut>::visit_mut_stmts::hcae36f60d3b1c232
  22:     0x55959871dfb8 - <swc_ecma_transforms_proposal::decorator_2022_03::Decorator202203 as swc_ecma_visit::VisitMut>::visit_mut_module_items::hbdeaf89632dc8472
  23:     0x55959862ea0b - <swc_ecma_ast::module::Program as swc_ecma_visit::FoldWith<V>>::fold_with::h02ff6ae2b1b21ddd
  24:     0x55959864b46a - deno_ast::transpiling::fold_program::h1b6242eb82aae422
  25:     0x55959864982f - deno_ast::transpiling::<impl deno_ast::parsed_source::ParsedSource>::transpile::h591a55942cd5a4fb
  26:     0x559596dff2b5 - deno::emit::Emitter::emit_parsed_source::h388a95e9a291f164
  27:     0x559596ebc42f - deno::module_loader::PreparedModuleLoader::load_prepared_module::h558eea220d21a92f
  28:     0x559596ebd3b3 - <deno::module_loader::CliModuleLoader as deno_core::modules::loaders::ModuleLoader>::load::h2f9df19ca44a87fc
  29:     0x55959899b837 - deno_core::modules::recursive_load::RecursiveModuleLoad::register_and_recurse_inner::{{closure}}::h59211fd66b7ddbd6
  30:     0x55959899c294 - <deno_core::modules::recursive_load::RecursiveModuleLoad as futures_core::stream::Stream>::poll_next::he227315ea6ed4e78
  31:     0x559596d71d16 - <futures_util::stream::stream::next::Next<St> as core::future::future::Future>::poll::h871f06c965f0c380
  32:     0x559596fbb8b7 - deno::worker::CliMainWorker::execute_main_module_possibly_with_npm::{{closure}}::hfa15fcea1b7f4370
  33:     0x559596fbaa4d - deno::worker::CliMainWorker::run::{{closure}}::h7a50a785a8edd17c
  34:     0x559596f7771b - deno::tools::run::run_script::{{closure}}::hf41b5654fa6d17f6
  35:     0x559596fc82c5 - deno::spawn_subcommand::{{closure}}::h55e855a5d16937b9
  36:     0x559596d51c72 - <deno_unsync::task::MaskFutureAsSend<F> as core::future::future::Future>::poll::h57107fd877fee895
  37:     0x559596c592f0 - tokio::runtime::task::raw::poll::h65d34ed9e561753f
  38:     0x559596fe340a - deno::main::h153ff61ece3725c8
  39:     0x559596b696cd - std::sys_common::backtrace::__rust_begin_short_backtrace::hebacd7307f7a0062
  40:     0x559596b6f4ca - std::rt::lang_start::{{closure}}::hd8f60ff6849a90f2
  41:     0x559596a9ec91 - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h37600b1e5eea4ecd
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/core/src/ops/function.rs:284:13
  42:     0x559596a9ec91 - std::panicking::try::do_call::hb4bda49fa13a0c2b
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  43:     0x559596a9ec91 - std::panicking::try::h8bbf75149211aaaa
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  44:     0x559596a9ec91 - std::panic::catch_unwind::h8c78ec68ebea34cb
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  45:     0x559596a9ec91 - std::rt::lang_start_internal::{{closure}}::hffdf44a19fd9e220
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:48
  46:     0x559596a9ec91 - std::panicking::try::do_call::hcb3194972c74716d
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:552:40
  47:     0x559596a9ec91 - std::panicking::try::hcdc6892c5f0dba4c
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panicking.rs:516:19
  48:     0x559596a9ec91 - std::panic::catch_unwind::h4910beb4573f4776
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/panic.rs:142:14
  49:     0x559596a9ec91 - std::rt::lang_start_internal::h6939038e2873596b
                               at /rustc/07dca489ac2d933c78d3c5158e3f43beefeb02ce/library/std/src/rt.rs:148:20
  50:     0x559597080fa5 - main
  51:     0x7f0175629d90 - <unknown>
  52:     0x7f0175629e40 - __libc_start_main
  53:     0x55959566e029 - _start

kdy1 pushed a commit to swc-project/swc that referenced this pull request Apr 4, 2024
**Description:**

Fixes an incorrect capacity (found while investigating a segfault).

More details: denoland/deno#23187 (comment)
@kdy1
Copy link

kdy1 commented Apr 11, 2024

Maybe related: vercel/next.js#63924

Let's collect all debug information at swc-project/swc#8840

@dsherret dsherret changed the title fix(swc): upgrade swc to fix issues with using statement fix: upgrade deno_ast related crates Apr 11, 2024
Copy link
Member

@bartlomieju bartlomieju left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, provided the tests pass

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

Successfully merging this pull request may close these issues.

5 participants