Skip to content

Crash on startup after updating my system: "Panic: runtime error: invalid memory address or nil pointer dereference" #194

Closed
@Invertisment

Description

@Invertisment

Describe the problem

I enter my NVIM and it starts the LSP server.

Almost immediately the LSP server crashes with this message in the editor:

Client 1 quit with exit code 2 and signal 0

Then I get this message in the LSP log:

[ERROR][2024-08-09 15:03:11] .../vim/lsp/rpc.lua:734	"rpc"	"/home/_/go/bin/arduino-language-server"	"stderr"	"15:03:11.573161 \27[96mINIT --- : running: /usr/bin/arduino-cli --config-file /home/_/.arduino15/arduino-cli.yaml config dump --format json\27[0m\n"
[ERROR][2024-08-09 15:03:11] .../vim/lsp/rpc.lua:734	"rpc"	"/home/_/go/bin/arduino-language-server"	"stderr"	"15:03:11.582275 \27[96mINIT --- : Arduino Data Dir -> \27[0m\n"
[ERROR][2024-08-09 15:03:11] .../vim/lsp/rpc.lua:734	"rpc"	"/home/_/go/bin/arduino-language-server"	"stderr"	"15:03:11.582366 Panic: runtime error: invalid memory address or nil pointer dereference\n\ngoroutine 18 [running]:\nruntime/debug.Stack()\n\t/usr/lib/go/src/runtime/debug/stack.go:24 +0x5e\ngithub.com/arduino/arduino-language-server/streams.CatchAndLogPanic()\n\t/home/_/go/pkg/mod/github.com/arduino/[email protected]/streams/panics.go:29 +0x7e\npanic({0xaa17c0?, 0x1114170?})\n\t/usr/lib/go/src/runtime/panic.go:770 +0x132\ngithub.com/arduino/go-paths-helper.(*Path).Clone(...)\n\t/home/_/go/pkg/mod/github.com/arduino/[email protected]/paths.go:81\ngithub.com/arduino/go-paths-helper.(*Path).Canonical(0xc000251c10?)\n\t/home/_/go/pkg/mod/github.com/arduino/[email protected]/paths.go:536 +0x19\ngithub.com/arduino/arduino-language-server/ls.(*INOLanguageServer).extractDataFolderFromArduinoCLI(0xc000000480, {0xc84d80, 0xc000388000})\n\t/home/_/go/pkg/mod/github.com/arduino/[email protected]/ls/ls.go:1485 +0x98d\ngithub.com/arduino/arduino-language-server/ls.(*INOLanguageServer).initializeReqFromIDE.func1()\n\t/home/_/go/pkg/mod/github.com/arduino/[email protected]/ls/ls.go:215 +0x36a\ncreated by github.com/arduino/arduino-language-server/ls.(*INOLanguageServer).initializeReqFromIDE in goroutine 8\n\t/home/_/go/pkg/mod/github.com/arduino/[email protected]/ls/ls.go:189 +0x205\n\n"
[ERROR][2024-08-09 15:03:11] .../vim/lsp/rpc.lua:734	"rpc"	"/home/_/go/bin/arduino-language-server"	"stderr"	"panic: runtime error: invalid memory address or nil pointer dereference [recovered]\n\tpanic: runtime error: invalid memory address or nil pointer dereference\n[signal "
[ERROR][2024-08-09 15:03:11] .../vim/lsp/rpc.lua:734	"rpc"	"/home/_/go/bin/arduino-language-server"	"stderr"	"SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x790c99]\n\ngoroutine 18 [running]:\ngithub.com/arduino/arduino-language-server/streams.CatchAndLogPanic()\n\t/home/_/go/pkg/mod/github.com/arduino/[email protected]/streams/panics.go:30 +0x194\npanic({0xaa17c0?, 0x1114170?})\n\t/usr/lib/go/src/runtime/panic.go:770 +0x132\ngithub.com/arduino/go-paths-helper.(*Path).Clone(...)\n\t/home/_/go/pkg/mod/github.com/arduino/[email protected]/paths.go:81\ngithub.com/arduino/go-paths-helper.(*Path).Canonical(0xc000251c10?)\n\t/home/_/go/pkg/mod/github.com/arduino/[email protected]/paths.go:536 +0x19\ngithub.com/arduino/arduino-language-server/ls.(*INOLanguageServer).extractDataFolderFromArduinoCLI(0xc000000480, {0xc84d80, 0xc000388000})\n\t/home/_/go/pkg/mod/github.com/arduino/[email protected]/ls/ls.go"
[ERROR][2024-08-09 15:03:11] .../vim/lsp/rpc.lua:734	"rpc"	"/home/_/go/bin/arduino-language-server"	"stderr"	":1485 +0x98d\ngithub.com/arduino/arduino-language-server/ls.(*INOLanguageServer).initializeReqFromIDE.func1()\n\t/home/_/go/pkg/mod/github.com/arduino/[email protected]/ls/ls.go:215 +0x36a\ncreated by github.com/arduino/arduino-language-server/ls.(*INOLanguageServer).initializeReqFromIDE in goroutine 8\n\t/home/martin/go/pkg/mod/github.com/arduino/[email protected]/ls/ls.go:189 +0x205\n"

To reproduce

It's enough to start my editor with .ino file.

clangd version 18.1.8

NVIM v0.9.5 (I had to downgrade from 10.1 because of this bug: #186)

Expected behavior

No crash.

Arduino Language Server version

0.7.6

Arduino CLI version

1.0.3-arch Commit: 8b6ad258e88581a9e77b2eede65aeeeeb265008c

Operating system

Linux

Operating system version

6.9.12-1-MANJARO

Additional context

Note: If I upgrade to the @latest unstable version then it doesn't crash (go install github.com/arduino/arduino-language-server@latest)

Issue checklist

  • I searched for previous reports in the issue tracker
  • I verified the problem still occurs when using the latest version
  • My report contains all necessary details

Metadata

Metadata

Assignees

No one assigned

    Labels

    conclusion: invalidIssue/PR not validtopic: codeRelated to content of the project itselftype: imperfectionPerceived defect in any part of project

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions