getsentry / rust-sourcemap

A library for rust that implements basic sourcemap handling
Other
224 stars 27 forks source link

to_wirter hangs and eats lots of memory #24

Closed kdy1 closed 9 months ago

kdy1 commented 4 years ago
test issue_622 ... test issue_622 has been running for over 60 seconds
thread 'issue_622' panicked at 'attempt to add with overflow', /home/kdy/.cargo/registry/src/github.com-1ecc6299db9ec823/sourcemap-5.0.0/src/encoder.rs:42:17

Stack trace:

stack backtrace:
   0:     0x564eebc37e14 - backtrace::backtrace::libunwind::trace::hb827f4c466253f29
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
   1:     0x564eebc37e14 - backtrace::backtrace::trace_unsynchronized::h9d5f4880ced35a0e
                               at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
   2:     0x564eebc37e14 - std::sys_common::backtrace::_print_fmt::hb1cddf0dbc858d5e
                               at src/libstd/sys_common/backtrace.rs:78
   3:     0x564eebc37e14 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h418b05c8466523f7
                               at src/libstd/sys_common/backtrace.rs:59
   4:     0x564eebc5d63c - core::fmt::write::hd7c4c3ef1c519f9c
                               at src/libcore/fmt/mod.rs:1053
   5:     0x564eebc33f67 - std::io::Write::write_fmt::hea7ee7c2b0b56640
                               at src/libstd/io/mod.rs:1428
   6:     0x564eebc3a665 - std::sys_common::backtrace::_print::hd48ee8e8dcfec814
                               at src/libstd/sys_common/backtrace.rs:62
   7:     0x564eebc3a665 - std::sys_common::backtrace::print::hd560d375c3dd4d06
                               at src/libstd/sys_common/backtrace.rs:49
   8:     0x564eebc3a665 - std::panicking::default_hook::{{closure}}::hbd5f2fc476d36ee7
                               at src/libstd/panicking.rs:204
   9:     0x564eebc3a3a7 - std::panicking::default_hook::h04bf70bf3772f200
                               at src/libstd/panicking.rs:224
  10:     0x564eebc3acc2 - std::panicking::rust_panic_with_hook::h98c3e5a93afaee15
                               at src/libstd/panicking.rs:470
  11:     0x564eebc3a8ab - rust_begin_unwind
                               at src/libstd/panicking.rs:378
  12:     0x564eebc5bd51 - core::panicking::panic_fmt::he958d82119fc3512
                               at src/libcore/panicking.rs:85
  13:     0x564eebc5bc9d - core::panicking::panic::h2182320983324d30
                               at src/libcore/panicking.rs:52
  14:     0x564eeb9c3ccd - sourcemap::encoder::serialize_mappings::he5368c381bf98d54
                               at /home/kdy/.cargo/registry/src/github.com-1ecc6299db9ec823/sourcemap-5.0.0/src/encoder.rs:42
  15:     0x564eeb9d425e - <sourcemap::types::SourceMap as sourcemap::encoder::Encodable>::as_raw_sourcemap::h6f43577b5b0cb976
                               at /home/kdy/.cargo/registry/src/github.com-1ecc6299db9ec823/sourcemap-5.0.0/src/encoder.rs:94
  16:     0x564eea427742 - sourcemap::encoder::encode::hc6722bd8ffafcc03
                               at /home/kdy/.cargo/registry/src/github.com-1ecc6299db9ec823/sourcemap-5.0.0/src/encoder.rs:16
  17:     0x564eea423dfb - sourcemap::types::SourceMap::to_writer::h0c5635f97e1a60b7
                               at /home/kdy/.cargo/registry/src/github.com-1ecc6299db9ec823/sourcemap-5.0.0/src/types.rs:478
  18:     0x564eea2741f3 - swc::Compiler::print::{{closure}}::h7ca634e6010c1591
                               at src/lib.rs:174
  19:     0x564eea272bba - swc::Compiler::run::{{closure}}::{{closure}}::h087de114b333ac69
                               at src/lib.rs:73
  20:     0x564eea4253a8 - scoped_tls::ScopedKey<T>::set::hc190b4c7bb37c6a0
                               at /home/kdy/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
  21:     0x564eea272dde - swc::Compiler::run::{{closure}}::h19dcdc2181546ec4
                               at src/lib.rs:71
  22:     0x564eea4254e8 - scoped_tls::ScopedKey<T>::set::hc2cdff0b532954cc
                               at /home/kdy/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
  23:     0x564eea272b04 - swc::Compiler::run::hbd5e47b903b96686
                               at src/lib.rs:69
  24:     0x564eea06bb9f - swc::Compiler::print::hc94c69917cd8ed00
                               at src/lib.rs:132
  25:     0x564eea277284 - swc::Compiler::process_js::{{closure}}::hc69470c45ef572d0
                               at src/lib.rs:325
  26:     0x564eea272c0d - swc::Compiler::run::{{closure}}::{{closure}}::h178632b111fc47b3
                               at src/lib.rs:73
  27:     0x564eea4258c8 - scoped_tls::ScopedKey<T>::set::hff32a7a440a593d2
                               at /home/kdy/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
  28:     0x564eea272d61 - swc::Compiler::run::{{closure}}::h142cf64906a83caa
                               at src/lib.rs:71
  29:     0x564eea425769 - scoped_tls::ScopedKey<T>::set::hd54f0bac5f538779
                               at /home/kdy/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
  30:     0x564eea2729f7 - swc::Compiler::run::h320243fd7a12f915
                               at src/lib.rs:69
  31:     0x564eea276b46 - swc::Compiler::process_js::h21f3a17244ee20b0
                               at src/lib.rs:305
  32:     0x564eea06bf19 - swc::Compiler::process_js_file::h6fc3ce69f2d0d0ef
                               at src/lib.rs:294
  33:     0x564eea000038 - source_map::file::{{closure}}::hd88aaa7625176259
                               at tests/source_map.rs:15
  34:     0x564eea002ac1 - testing::Tester::print_errors::{{closure}}::hfba82fd93183fa04
                               at /home/kdy/projects/swc/testing/src/lib.rs:121
  35:     0x564eea000baf - scoped_tls::ScopedKey<T>::set::h45b840b7d7281ae6
                               at /home/kdy/.cargo/registry/src/github.com-1ecc6299db9ec823/scoped-tls-1.0.0/src/lib.rs:137
  36:     0x564eea002839 - testing::Tester::print_errors::h7c03500bc5d6c45d
                               at /home/kdy/projects/swc/testing/src/lib.rs:121
  37:     0x564eea000d90 - source_map::file::hf02ac7086b00092b
                               at tests/source_map.rs:9
  38:     0x564eea000deb - source_map::issue_622::h4c1bee7e0e1fc348
                               at tests/source_map.rs:55
  39:     0x564eea00092a - source_map::issue_622::{{closure}}::hdfd4a6add5f16595
                               at tests/source_map.rs:54
  40:     0x564eea000ece - core::ops::function::FnOnce::call_once::h914c35de894d1b9d
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/libcore/ops/function.rs:232
  41:     0x564eea00fcbf - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h78dc70e80892ee4d
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/liballoc/boxed.rs:1017
  42:     0x564eebc426f7 - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:86
  43:     0x564eea02ba36 - std::panicking::try::h1193c460e1718171
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/libstd/panicking.rs:281
  44:     0x564eea02ba36 - std::panic::catch_unwind::h163cbf2d8c71ea4f
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/libstd/panic.rs:394
  45:     0x564eea02ba36 - test::run_test_in_process::hc0ac989c0c877eda
                               at src/libtest/lib.rs:542
  46:     0x564eea02ba36 - test::run_test::run_test_inner::{{closure}}::h16bcc9da299fa080
                               at src/libtest/lib.rs:451
  47:     0x564eea003046 - std::sys_common::backtrace::__rust_begin_short_backtrace::h2d43b07eb58e6fec
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/libstd/sys_common/backtrace.rs:130
  48:     0x564eea007836 - std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}::h7f845242723d073e
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/libstd/thread/mod.rs:475
  49:     0x564eea007836 - <std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once::hd0a6ccfb2079bc4a
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/libstd/panic.rs:318
  50:     0x564eea007836 - std::panicking::try::do_call::h97ab63ef8bb63089
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/libstd/panicking.rs:303
  51:     0x564eebc426f7 - __rust_maybe_catch_panic
                               at src/libpanic_unwind/lib.rs:86
  52:     0x564eea0083a6 - std::panicking::try::h8790f980cc12634a
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/libstd/panicking.rs:281
  53:     0x564eea0083a6 - std::panic::catch_unwind::h8447e5cab7f3c687
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/libstd/panic.rs:394
  54:     0x564eea0083a6 - std::thread::Builder::spawn_unchecked::{{closure}}::h08723c2810a9c6d3
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/libstd/thread/mod.rs:474
  55:     0x564eea0083a6 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hb90e59c7caac7f1f
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/libcore/ops/function.rs:232
  56:     0x564eebc2d67f - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::ha0137aa2056446ec
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/liballoc/boxed.rs:1017
  57:     0x564eebc418a0 - <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::h335d32c504b6aa26
                               at /rustc/0eb878d2aa6e3a1cb315f3f328681b26bb4bffdb/src/liballoc/boxed.rs:1017
  58:     0x564eebc418a0 - std::sys_common::thread::start_thread::h6e1133a4f62ec9db
                               at src/libstd/sys_common/thread.rs:13
  59:     0x564eebc418a0 - std::sys::unix::thread::Thread::new::thread_start::h0a1909c3d640ef9b
                               at src/libstd/sys/unix/thread.rs:80
  60:     0x7fd3181bf6db - start_thread
  61:     0x7fd317cd088f - __clone
  62:                0x0 - <unknown>

It also eats lots of memory. 스크린샷, 2020-03-02 16-35-40

kdy1 commented 4 years ago

I found the issue. Order is important.

1:38 <- 0:10
1:41 <- 0:13
2:9 <- 0:10
2:12 <- 0:13
3:44 <- 0:10
3:48 <- 0:13
8:23 <- 2:21
8:27 <- 2:25

works while

1:38 <- 0:10
2:9 <- 0:10
3:44 <- 0:10
1:41 <- 0:13
2:12 <- 0:13
3:48 <- 0:13
8:23 <- 2:21
8:27 <- 2:25

does not.

Format is (dst <- src)

kdy1 commented 9 months ago

Closing as obsolete