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

thread 'main' panicked at 'assertion failed: self.len_after == other.len', helix-core/src/transaction.rs:116:9 #4957

Closed
ocharles opened this issue Dec 1, 2022 · 7 comments · Fixed by #4981
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug
Milestone

Comments

@ocharles
Copy link
Contributor

ocharles commented Dec 1, 2022

Summary

While editing, Helix crashed with the error:

thread 'main' panicked at 'assertion failed: self.len_after == other.len', helix-core/src/transaction.rs:116:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Reproduction Steps

Unfortunately I don't have steps to reproduce yet.

Helix log

The last 50 lines are:

~/.cache/helix/helix.log
2022-12-01T09:05:06.668 helix_lsp::transport [ERROR] err <- "             , floskell\n"
2022-12-01T09:05:06.668 helix_lsp::transport [ERROR] err <- "             , ghcide-extend-import-action\n"
2022-12-01T09:05:06.668 helix_lsp::transport [ERROR] err <- "             , codeRange\n"
2022-12-01T09:05:06.668 helix_lsp::transport [ERROR] err <- "             , importLens\n"
2022-12-01T09:05:06.668 helix_lsp::transport [ERROR] err <- "             , retrie\n"
2022-12-01T09:05:06.668 helix_lsp::transport [ERROR] err <- "             , ghcide-type-lenses\n"
2022-12-01T09:05:06.668 helix_lsp::transport [ERROR] err <- "             , ghcide-code-actions-imports-exports\n"
2022-12-01T09:05:06.668 helix_lsp::transport [ERROR] err <- "             , ghcide-hover-and-symbols\n"
2022-12-01T09:05:06.668 helix_lsp::transport [ERROR] err <- "             , eval\n"
2022-12-01T09:05:06.668 helix_lsp::transport [ERROR] err <- "             , gadt\n"
2022-12-01T09:05:06.668 helix_lsp::transport [ERROR] err <- "             , callHierarchy\n"
2022-12-01T09:05:06.669 helix_lsp::transport [ERROR] err <- "             , ghcide-code-actions-type-signatures\n"
2022-12-01T09:05:06.669 helix_lsp::transport [ERROR] err <- "             , ghcide-code-actions-bindings\n"
2022-12-01T09:05:06.669 helix_lsp::transport [ERROR] err <- "             , moduleName\n"
2022-12-01T09:05:06.669 helix_lsp::transport [ERROR] err <- "             , ghcide-core\n"
2022-12-01T09:05:06.669 helix_lsp::transport [ERROR] err <- "             , explicitFixity ]\n"
2022-12-01T09:05:06.669 helix_lsp::transport [ERROR] err <- "2022-12-01T09:05:06.669175Z | Info | Logging heap statistics every 60.00s\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- " 2022-12-01T09:05:06.674245Z | Info | Starting LSP server...\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "  If you are seeing this in a terminal, you probably should have run WITHOUT the --lsp option!\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "  PluginIds: [ pragmas\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , LSPRecorderCallback\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , rename\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , ghcide-completions\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , class\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , refineImports\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , changeTypeSignature\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , alternateNumberFormat\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , ghcide-code-actions-fill-holes\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , floskell\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , ghcide-extend-import-action\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , codeRange\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , importLens\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , retrie\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , ghcide-type-lenses\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , ghcide-code-actions-imports-exports\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , ghcide-hover-and-symbols\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , eval\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , gadt\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , callHierarchy\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , ghcide-code-actions-type-signatures\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , ghcide-code-actions-bindings\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , moduleName\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , ghcide-core\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "             , explicitFixity ]\n"
2022-12-01T09:05:06.674 helix_lsp::transport [ERROR] err <- "2022-12-01T09:05:06.674481Z | Info | Starting server\n"
2022-12-01T09:05:06.675 helix_lsp::transport [ERROR] err <- "2022-12-01T09:05:06.675405Z | Info | Started LSP server in 0.00s\n"
2022-12-01T09:05:06.858 helix_lsp::transport [ERROR] err <- "2022-12-01T09:05:06.857957Z | Warning | Couldn't load cradle. Cradle not found.\n"
2022-12-01T09:05:06.858 helix_lsp::transport [ERROR] err <- "2022-12-01T09:05:06.858095Z | Warning | Currently, HLS supports GHC 9.2 only partially. See [issue #2982](https://github.com/haskell/haskell-language-server/issues/2982) for more detail.\n"
2022-12-01T09:05:06.858 helix_lsp::transport [ERROR] err <- "2022-12-01T09:05:06.858396Z | Info | Registering IDE configuration: IdeConfiguration {workspaceFolders = fromList [NormalizedUri (-7090588869910987610) \"file:///home/ollie/work/circuithub\"], clientSettings = hashed Nothing}\n"
2022-12-01T09:05:06.980 helix_lsp::transport [ERROR] err <- "2022-12-01T09:05:06.980584Z | Info | Cradle path: picofactory/pnp/lib/CircuitHub/PNP/Job/Controller.hs\n"

Platform

Linux

Terminal Emulator

Kitty

Helix Version

22.08.1-527-g5a3ff742

@ocharles ocharles added the C-bug Category: This is a bug label Dec 1, 2022
@archseer
Copy link
Member

archseer commented Dec 1, 2022

g5a3ff742 doesn't seem to be a commit on master: g5a3ff742

@ocharles
Copy link
Contributor Author

ocharles commented Dec 1, 2022

Yea, I dunno what's going on there:

helix on  master via 🦀 v1.62.0 
❯ git rev-parse HEAD
5a3ff742218aac32c3af08993f0edb623631fc72

helix on  master via 🦀 v1.62.0 
❯ git describe
22.08.1-527-g5a3ff742

@the-mikedavis
Copy link
Member

Ah yeah, the git describe format puts a g in front of the sha. This one is 5a3ff74

@the-mikedavis the-mikedavis added the A-helix-term Area: Helix term improvements label Dec 1, 2022
@archseer
Copy link
Member

archseer commented Dec 2, 2022

Full backtrace:

thread 'main' panicked at 'assertion failed: self.len_after == other.len', helix-core/src/transaction.rs:116:9
stack backtrace:
   0: rust_begin_unwind
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
   2: core::panicking::panic
             at /rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:48:5
   3: helix_core::transaction::ChangeSet::compose
   4: helix_core::transaction::Transaction::compose
   5: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
   6: helix_core::history::History::changes_since
   7: helix_view::view::View::sync_changes
   8: helix_view::editor::Editor::_refresh
   9: helix_view::editor::Editor::switch
  10: helix_term::commands::split
  11: helix_term::ui::editor::EditorView::handle_keymap_event::{{closure}}
  12: helix_term::ui::editor::EditorView::handle_keymap_event
  13: <helix_term::ui::editor::EditorView as helix_term::compositor::Component>::handle_event
  14: helix_term::compositor::Compositor::handle_event
  15: helix_term::application::Application::run::{{closure}}
  16: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
  17: tokio::runtime::park::CachedParkThread::block_on
  18: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
  19: tokio::runtime::runtime::Runtime::block_on
  20: hx::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@archseer archseer added this to the 22.12 milestone Dec 2, 2022
@kirawi
Copy link
Member

kirawi commented Dec 2, 2022

I encountered this after having a buffer open in two vertical splits with cursors in different locations, and then switching over to the other split after editing text in the first one. It seems to be a different cause, but maybe related?

thread 'main' panicked at 'assertion failed: self.len_after == other.len', helix-core\src\transaction.rs:116:9
stack backtrace:
   0: std::panicking::begin_panic_handler
             at /rustc/2585bcea0bc2a9c42a4be2c1eba5c61137f2b167/library\std\src\panicking.rs:575
   1: core::panicking::panic_fmt
             at /rustc/2585bcea0bc2a9c42a4be2c1eba5c61137f2b167/library\core\src\panicking.rs:65
   2: core::panicking::panic
             at /rustc/2585bcea0bc2a9c42a4be2c1eba5c61137f2b167/library\core\src\panicking.rs:114
   3: helix_core::transaction::ChangeSet::compose
   4: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
   5: helix_core::history::History::changes_since
   6: helix_view::view::View::sync_changes
   7: helix_view::editor::Editor::focus
   8: helix_term::ui::editor::EditorView::highlight_cursorcolumn
   9: helix_term::ui::editor::EditorView::highlight_cursorcolumn
  10: <helix_term::ui::editor::EditorView as helix_term::compositor::Component>::handle_event
  11: helix_term::compositor::Compositor::handle_event
  12: hx::main_impl::{{closure}}
  13: tokio::runtime::park::CachedParkThread::block_on
  14: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
  15: tokio::runtime::runtime::Runtime::block_on
  16: hx::setup_logging
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

@the-mikedavis
Copy link
Member

the-mikedavis commented Dec 2, 2022

I found a small reproduction case for this: it happens when you have the same file open in two splits, undo in one split and then apply more changes and then navigate back to the other window. The path from old history state to new history state is missing the lowest-common-ancestor element is not chaining the up and down parts in the correct order. I should be able to make a fix in a few hours.

[<space>[<space>[<space><C-w>v<C-s><C-w>wuu[<space>[<space>[<space><C-w>w

@ocharles
Copy link
Contributor Author

ocharles commented Dec 3, 2022

Big thank you to everyone for helping resolve this so quickly - y'all are the best! 🥰 Hopefully soon I can do more than just say "hey, this thing is broken" 😅

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants