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

Crash when formatting document #4673

Closed
Jummit opened this issue Nov 9, 2022 · 4 comments
Closed

Crash when formatting document #4673

Jummit opened this issue Nov 9, 2022 · 4 comments
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.

Comments

@Jummit
Copy link
Contributor

Jummit commented Nov 9, 2022

Summary

After I formatted my JSON file I got a crash with this stack trace:

thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Invalid char range 820..806: start must be <= end', /home/jummit/.local/share/cargo/registry/src/github.com-1ecc6299db9ec823/ropey-1.5.0/src/rope.rs:546:37
stack backtrace:
   0:     0x5633d2a0e9f4 - std::backtrace_rs::backtrace::libunwind::trace::h22893a5306c091b4
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1:     0x5633d2a0e9f4 - std::backtrace_rs::backtrace::trace_unsynchronized::h29c3bc6f9e91819d
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x5633d2a0e9f4 - std::sys_common::backtrace::_print_fmt::he497d8a0ec903793
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:66:5
   3:     0x5633d2a0e9f4 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h9c2a9d2774d81873
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:45:22
   4:     0x5633d2239edc - core::fmt::write::hba4337c43d992f49
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/fmt/mod.rs:1194:17
   5:     0x5633d2a08465 - std::io::Write::write_fmt::heb73de6e02cfabed
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/io/mod.rs:1655:15
   6:     0x5633d2a1089e - std::sys_common::backtrace::_print::h63c8b24acdd8e8ce
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:48:5
   7:     0x5633d2a1089e - std::sys_common::backtrace::print::h426700d6240cdcc2
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:35:9
   8:     0x5633d2a1089e - std::panicking::default_hook::{{closure}}::hc9a76eed0b18f82b
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:295:22
   9:     0x5633d2a105cd - std::panicking::default_hook::h2e88d02087fae196
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:314:9
  10:     0x5633d2a10f2b - std::panicking::rust_panic_with_hook::habfdcc2e90f9fd4c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:702:17
  11:     0x5633d2a10d54 - std::panicking::begin_panic_handler::{{closure}}::he054b2a83a51d2cd
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:588:13
  12:     0x5633d2a0ef24 - std::sys_common::backtrace::__rust_end_short_backtrace::ha48b94ab49b30915
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/sys_common/backtrace.rs:138:18
  13:     0x5633d2a10abd - rust_begin_unwind
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
  14:     0x5633d21b0d83 - core::panicking::panic_fmt::h366d3a309ae17c94
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
  15:     0x5633d21b0e73 - core::result::unwrap_failed::hddd78f4658ac7d0f
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/result.rs:1785:5
  16:     0x5633d2335c7a - ropey::rope::Rope::remove::hf1ad9ec94cd99ffb
  17:     0x5633d22d17d9 - helix_core::transaction::ChangeSet::apply::h7ecb9d9cf6e45120
  18:     0x5633d27f2a51 - helix_view::document::Document::apply_impl::h4ef6acec562a6f86
  19:     0x5633d27f40d7 - helix_view::document::Document::apply::h33fbb19381eb75bd
  20:     0x5633d24f5e39 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h15d00448a6a81091
  21:     0x5633d26ce29f - helix_term::job::Jobs::handle_callback::h128e937571176dc4
  22:     0x5633d2894dbe - helix_term::application::Application::event_loop_until_idle::{{closure}}::hcd286ef118ffc2d3
  23:     0x5633d28b2715 - <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll::h2d982445d9687573
  24:     0x5633d288f362 - std::thread::local::LocalKey<T>::with::hea25b5887e67b885
  25:     0x5633d287d988 - tokio::park::thread::CachedParkThread::block_on::hfe866ae60b16658e
  26:     0x5633d2866a38 - tokio::runtime::scheduler::multi_thread::MultiThread::block_on::h50a887f5d1dc6968
  27:     0x5633d28ae58e - tokio::runtime::Runtime::block_on::hfa8661930ef2e377
  28:     0x5633d28733f5 - hx::main::hcc1573d34705d938
  29:     0x5633d28766e3 - std::sys_common::backtrace::__rust_begin_short_backtrace::h6a0e679950ffe6d6
  30:     0x5633d288ee1d - std::rt::lang_start::{{closure}}::h12f12c05bd69c77e
  31:     0x5633d2a02d6b - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::had4f69b3aefb47a8
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:259:13
  32:     0x5633d2a02d6b - std::panicking::try::do_call::hf2ad5355fcafe775
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:492:40
  33:     0x5633d2a02d6b - std::panicking::try::h0a63ac363423e61e
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:456:19
  34:     0x5633d2a02d6b - std::panic::catch_unwind::h18088edcecb8693a
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panic.rs:137:14
  35:     0x5633d2a02d6b - std::rt::lang_start_internal::{{closure}}::ha7dad166dc711761
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:128:48
  36:     0x5633d2a02d6b - std::panicking::try::do_call::hda0c61bf3a57d6e6
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:492:40
  37:     0x5633d2a02d6b - std::panicking::try::hbc940e68560040a9
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:456:19
  38:     0x5633d2a02d6b - std::panic::catch_unwind::haed0df2aeb3fa368
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panic.rs:137:14
  39:     0x5633d2a02d6b - std::rt::lang_start_internal::h9c06694362b5b80c
                               at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/rt.rs:128:20
  40:     0x5633d2873502 - main
  41:     0x7fe766767290 - <unknown>
  42:     0x7fe76676734a - __libc_start_main
  43:     0x5633d21e8365 - _start
                               at /build/glibc/src/glibc/csu/../sysdeps/x86_64/start.S:115
  44:                0x0 - <unknown>

Reproduction Steps

  1. Select whole File (%)
  2. Format (:format)

Helix log

~/.cache/helix/helix.log
2022-11-09T11:35:17.182 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2022-11-09T11:35:42.928 helix_view::theme [WARN] Theme: malformed hexcode: indent
2022-11-09T11:45:14.238 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2022-11-09T11:54:54.710 helix_view::theme [WARN] Theme: malformed hexcode: indent
2022-11-09T11:54:58.263 helix_view::theme [WARN] Theme: malformed hexcode: indent
2022-11-09T11:55:18.601 helix_view::theme [WARN] Theme: malformed hexcode: indent
2022-11-09T11:56:07.303 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled
2022-11-09T11:56:42.673 helix_view::theme [WARN] Theme: malformed hexcode: indent
2022-11-09T12:00:37.144 helix_view::theme [WARN] Theme: malformed hexcode: indent
2022-11-09T12:05:54.362 helix_term::application [ERROR] received malformed notification from Language Server: Unhandled

Platform

Linux

Terminal Emulator

Gnome Terminal

Helix Version

helix 22.08.1 (97a38c4)

@Jummit Jummit added the C-bug Category: This is a bug label Nov 9, 2022
@archseer
Copy link
Member

archseer commented Nov 9, 2022

What formatter were you using?

@Jummit
Copy link
Contributor Author

Jummit commented Nov 9, 2022

I guess the one provided by vscode-json-language-server?

@the-mikedavis the-mikedavis added the A-helix-term Area: Helix term improvements label Nov 9, 2022
@pascalkuthe
Copy link
Member

I suspect that this is fixed by #5711. That PR also fixes #4791 which sounds quite similar to this PR. Do you have a reproduction case? Perhaphs the file contained some non-ascii chars? In that case I would be quite certain that this is fixed by #5711

@pascalkuthe pascalkuthe added the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. label Feb 7, 2023
@Jummit
Copy link
Contributor Author

Jummit commented May 1, 2023

Haven't got this crash in a while, closing.

@Jummit Jummit closed this as completed May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author.
Projects
None yet
Development

No branches or pull requests

4 participants