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: Position is out of range for changeset #4226

Closed
Jummit opened this issue Oct 12, 2022 · 4 comments · Fixed by #4227
Closed

Crash: Position is out of range for changeset #4226

Jummit opened this issue Oct 12, 2022 · 4 comments · Fixed by #4227
Labels
A-helix-term Area: Helix term improvements C-bug Category: This is a bug

Comments

@Jummit
Copy link
Contributor

Jummit commented Oct 12, 2022

Summary

I got this crash multiple times:

thread 'main' panicked at 'Position 738 is out of range for changeset len 695!', helix-core/src/transaction.rs:397:13

Reproduction Steps

I tried this:

  1. hx
  2. Navigate in the document

Helix log

~/.cache/helix/helix.log
2022-10-12T15:13:00.469 helix_term::application [WARN] lsp position out of bounds - Diagnostic { range: Range { start: Position { line: 43, character: 0 }, end: Position { line: 43, character: 1 } }, severity: Some(Error), code: None, code_description: None, source: Some("rustc"), message: "unexpected closing delimiter: `}`\nunexpected closing delimiter", related_information: Some([DiagnosticRelatedInformation { location: Location { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/jummit/Programming/tree-sitter-lsp/src/main.rs", query: None, fragment: None }, range: Range { start: Position { line: 40, character: 24 }, end: Position { line: 40, character: 25 } } }, message: "this opening brace..." }, DiagnosticRelatedInformation { location: Location { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/jummit/Programming/tree-sitter-lsp/src/main.rs", query: None, fragment: None }, range: Range { start: Position { line: 42, character: 4 }, end: Position { line: 42, character: 5 } } }, message: "...matches this closing brace" }]), tags: None, data: None }
2022-10-12T15:13:00.470 helix_term::application [WARN] lsp position out of bounds - Diagnostic { range: Range { start: Position { line: 42, character: 4 }, end: Position { line: 42, character: 5 } }, severity: Some(Hint), code: None, code_description: None, source: Some("rustc"), message: "...matches this closing brace", related_information: Some([DiagnosticRelatedInformation { location: Location { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/jummit/Programming/tree-sitter-lsp/src/main.rs", query: None, fragment: None }, range: Range { start: Position { line: 43, character: 0 }, end: Position { line: 43, character: 1 } } }, message: "original diagnostic" }]), tags: None, data: None }
2022-10-12T15:13:08.182 helix_term::application [WARN] lsp position out of bounds - Diagnostic { range: Range { start: Position { line: 42, character: 0 }, end: Position { line: 42, character: 1 } }, severity: Some(Error), code: None, code_description: None, source: Some("rustc"), message: "unexpected closing delimiter: `}`\nunexpected closing delimiter", related_information: Some([DiagnosticRelatedInformation { location: Location { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/jummit/Programming/tree-sitter-lsp/src/main.rs", query: None, fragment: None }, range: Range { start: Position { line: 39, character: 24 }, end: Position { line: 39, character: 25 } } }, message: "this opening brace..." }, DiagnosticRelatedInformation { location: Location { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/jummit/Programming/tree-sitter-lsp/src/main.rs", query: None, fragment: None }, range: Range { start: Position { line: 41, character: 4 }, end: Position { line: 41, character: 5 } } }, message: "...matches this closing brace" }]), tags: None, data: None }
2022-10-12T15:13:08.182 helix_term::application [WARN] lsp position out of bounds - Diagnostic { range: Range { start: Position { line: 41, character: 4 }, end: Position { line: 41, character: 5 } }, severity: Some(Hint), code: None, code_description: None, source: Some("rustc"), message: "...matches this closing brace", related_information: Some([DiagnosticRelatedInformation { location: Location { uri: Url { scheme: "file", cannot_be_a_base: false, username: "", password: None, host: None, port: None, path: "/home/jummit/Programming/tree-sitter-lsp/src/main.rs", query: None, fragment: None }, range: Range { start: Position { line: 42, character: 0 }, end: Position { line: 42, character: 1 } } }, message: "original diagnostic" }]), tags: None, data: None }

Platform

Linux

Terminal Emulator

Gnome Terminal

Helix Version

22.08.1 (c54a036)

@Jummit Jummit added the C-bug Category: This is a bug label Oct 12, 2022
@the-mikedavis the-mikedavis added the A-helix-term Area: Helix term improvements label Oct 12, 2022
@the-mikedavis
Copy link
Member

This is caused by the changes in #4186 but I think the crashes are red herrings of other problems with selections or transactions.

Do you remember what you were doing right before the crash? Navigating as you say in the reproduction steps should not cause this because navigating doesn't produce any transactions.

@Jummit
Copy link
Contributor Author

Jummit commented Oct 12, 2022

I think the crash occurred after exiting insert mode with some documentation open and moving about.
Aside, is this really an unrecoverable error? It feels like there shouldn't just be a panic! lying around in the code waiting to bite someone.

@dariooddenino
Copy link
Contributor

Experienced this today. It's very easy to replicate. From an empty buffer, type ia<esc>uia

The result is:

thread 'main' panicked at 'Position 2 is out of range for changeset len 1!', helix-core/src/transaction.rs:397:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@the-mikedavis
Copy link
Member

panic! calls in the source are usually assertions that are necessary for correctness. The problem was not really the panic but the funky state the editor got into (in this case by not applying transactions to the view in undo/redo).

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.

3 participants