Skip to content

Ark: LSP crash while looking for completions or creating new document context #2692

@lionel-

Description

@lionel-

Here is the state of my positron window when the crash happened. I was typing in the console IIRC:

Screenshot 2024-04-08 at 13 52 35

Complete logs:

Relevant part of the log (why is the leading json truncated like this?):

[R]         contents: [
[R]             "plo",
[R]         ],
[R]         ast: {Tree {Node program (0, 0) - (0, 3)}},
[R]     },
[R]     node: {Node identifier (0, 0) - (0, 3)},
[R]     point: Point {
[R]         row: 0,
[R]         column: 3,
[R]     },
[R]     trigger: None,
[R] }
[R] 2024-04-08T11:36:43.272029000Z [ark-unknown] INFO crates/ark/src/r_task.rs:55: Thread 'ark-lsp' (ThreadId(22)) is requesting a task.
[R] 2024-04-08T11:36:43.272119000Z [ark-unknown] INFO crates/ark/src/interface.rs:1026: Yielding to task - 0 more task(s) remaining
[R] 2024-04-08T11:36:43.272176000Z [ark-unknown] INFO crates/ark/src/lsp/completions/provide.rs:22: provide_completions()
[R] 2024-04-08T11:36:43.272206000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/unique.rs:31: completions_from_unique_sources()
[R] 2024-04-08T11:36:43.272252000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/unique/comment.rs:28: completions_from_comment()
[R] 2024-04-08T11:36:43.272281000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/unique/string.rs:16: completions_from_string()
[R] 2024-04-08T11:36:43.272306000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/unique/namespace.rs:36: completions_from_namespace()
[R] 2024-04-08T11:36:43.272335000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/unique/custom.rs:35: completions_from_custom_source()
[R] 2024-04-08T11:36:43.272362000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/unique/extractor.rs:48: completions_from_extractor()
[R] 2024-04-08T11:36:43.272386000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/unique/extractor.rs:48: completions_from_extractor()
[R] 2024-04-08T11:36:43.272410000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/composite.rs:43: completions_from_composite_sources()
[R] 2024-04-08T11:36:43.272433000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/composite/pipe.rs:59: find_pipe_root()
[R] 2024-04-08T11:36:43.272465000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/composite/call.rs:33: completions_from_call()
[R] 2024-04-08T11:36:43.272492000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/composite/subset.rs:27: completions_from_subset()
[R] 2024-04-08T11:36:43.272567000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/composite/keyword.rs:12: completions_from_keywords()
[R] 2024-04-08T11:36:43.272608000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/composite/snippets.rs:42: completions_from_snippets()
[R] 2024-04-08T11:36:43.273950000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/composite/search_path.rs:31: completions_from_search_path()
[R] 2024-04-08T11:36:43.921781000Z [ark-unknown] INFO crates/ark/src/lsp/completions/sources/composite/workspace.rs:29: completions_from_workspace()
[R] 2024-04-08T11:36:43.924301000Z [ark-unknown] INFO crates/ark/src/r_task.rs:129: Thread 'ark-lsp' (ThreadId(22)) was unblocked after waiting for 652 milliseconds.
[R] 2024-04-08T11:36:43.978311000Z [ark-unknown] ERROR crates/ark/src/main.rs:461: Panic! In file 'crates/ark/src/lsp/document_context.rs' at line 28: called `Option::unwrap()` on a `None` value
[R] 2024-04-08T11:36:44.281187000Z [ark-unknown] TRACE crates/amalthea/src/wire/wire_message.rs:201: Sending 'stream' message via IOPub socket
[R] 2024-04-08T11:36:44.366263000Z [ark-unknown] TRACE crates/amalthea/src/wire/wire_message.rs:201: Sending 'stream' message via IOPub socket
[R] 2024-04-08T11:36:44.529633000Z [ark-unknown] TRACE crates/amalthea/src/wire/wire_message.rs:201: Sending 'stream' message via IOPub socket
[R] *** Log ended at Mon Apr  8 13:36:44 CEST 2024
[R] Process exit code 134
[R] 
[Positron] R kernel status changed: idle => exited
[Positron] No socket shell found.

Unfortunately the backtrace is missing from the logs for some reason. The crash happens here, we might want to replace the unwrap() with some logging:

https://github.com/posit-dev/amalthea/blob/ce635139ac93f22a12316710e640d601c80981cd/crates/ark/src/lsp/document_context.rs#L28

Slack threads:

Metadata

Metadata

Assignees

Labels

area: completionsIssues related to Completionsarea: kernelsIssues related to Jupyter kernels and LSP serversbugSomething isn't workinglang: r

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions