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

[BUG] LSP Crash with basic trait and __contains__ #2757

Open
Benny-Nottonson opened this issue May 20, 2024 · 0 comments
Open

[BUG] LSP Crash with basic trait and __contains__ #2757

Benny-Nottonson opened this issue May 20, 2024 · 0 comments
Labels
bug Something isn't working crash Initiative: LSP mojo-repo Tag all issues with this label

Comments

@Benny-Nottonson
Copy link

Benny-Nottonson commented May 20, 2024

Bug description

The following code will immedately crash the LSP repeatedly, causing it to shut down with the message The Mojo Language Client server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information. The issue does not resolve if the LSP or VSCode are restarted.

Steps to reproduce

Code

trait Container:
    fn __contains__[T: AnyType](self, value: T) -> Bool:
        ...

System information

WSL2 Ubuntu v22.04
mojo 24.3.0 (9882e19d)
modular 0.7.4 (df7a9e8b)

Full Stack

I[20:39:09.292] --> initialize(0)
I[20:39:09.292] --> reply:(0)
D[20:39:09.292] >>> {"id":0,"jsonrpc":"2.0","result":{"capabilities":{"codeActionProvider":{"codeActionKinds":["quickfix","refactor","info"]},"completionProvider":{"allCommitCharacters":["\t","."],"resolveProvider":false,"triggerCharacters":["."]},"definitionProvider":true,"documentSymbolProvider":true,"foldingRangeProvider":true,"hoverProvider":true,"inlayHintProvider":true,"notebookDocumentSync":{"notebookSelector":[{"cells":[{"language":"mojo"}],"notebook":{"notebookType":"jupyter-notebook","scheme":"file"}}]},"referencesProvider":true,"semanticTokensProvider":{"full":{"delta":true},"legend":{"tokenModifiers":[],"tokenTypes":["variable","specialVariable","parameter","function","method","property","class","interface","type","namespace"]},"range":false},"signatureHelpProvider":{"triggerCharacters":["(","[",","]},"textDocumentSync":{"change":2,"openClose":true,"save":true}},"serverInfo":{"name":"mojo-lsp-server","version":"0.0.1"}}}

I[20:39:09.292] --> initialized
I[20:39:09.294] --> textDocument/didOpen
D[20:39:09.294] --> textDocument/didOpen: uri='file:///home/benny/mojo-abc/collections.mojo', version=1
I[20:39:09.299] --> textDocument/publishDiagnostics
D[20:39:09.299] >>> {"jsonrpc":"2.0","method":"textDocument/publishDiagnostics","params":{"diagnostics":[],"uri":"file:///home/benny/mojo-abc/collections.mojo","version":1}}

I[20:39:09.304] --> textDocument/documentSymbol(1)
I[20:39:09.304] --> textDocument/codeAction(2)
I[20:39:09.304] --> reply:(2)
D[20:39:09.305] >>> {"id":2,"jsonrpc":"2.0","result":[]}

[25362:25362:20240519,203909.307324:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[25362:25362:20240519,203909.307413:ERROR file_io_posix.cc:144] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
I[20:39:09.308] --> textDocument/inlayHint(3)
I[20:39:09.308] --> reply:(3)
D[20:39:09.308] >>> {"id":3,"jsonrpc":"2.0","result":[]}

Please submit a bug report to https://github.com/modularml/mojo/issues and include the crash backtrace along with all the relevant source codes with the contents they had at crash time.
 #0 0x000055c0920416d7 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/benny/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x8966d7)
 #1 0x000055c09203f52e llvm::sys::RunSignalHandlers() (/home/benny/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x89452e)
 #2 0x000055c092041d6f SignalHandler(int) (/home/benny/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x896d6f)
 #3 0x00007f450e6fe520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000055c09210c37c getIfNotOwnedFunctionArgument(M::MojoASTDeclRef) (/home/benny/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x96137c)
 #5 0x000055c09210cbbf M::MojoASTDeclRef::getView() const (/home/benny/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x961bbf)
 #6 0x000055c091f9798c M::Mojo::LSP::MojoDocument::getDocumentSymbols(M::MojoASTDeclRef, std::vector<mlir::lsp::DocumentSymbol, std::allocator<mlir::lsp::DocumentSymbol> >&, llvm::function_ref<bool (M::MojoASTDeclRef)>) (/home/benny/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x7ec98c)
 #7 0x000055c091f982a6 M::Mojo::LSP::MojoDocument::getDocumentSymbols(M::MojoASTDeclRef, std::vector<mlir::lsp::DocumentSymbol, std::allocator<mlir::lsp::DocumentSymbol> >&, llvm::function_ref<bool (M::MojoASTDeclRef)>) (/home/benny/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x7ed2a6)
 #8 0x000055c091f982a6 M::Mojo::LSP::MojoDocument::getDocumentSymbols(M::MojoASTDeclRef, std::vector<mlir::lsp::DocumentSymbol, std::allocator<mlir::lsp::DocumentSymbol> >&, llvm::function_ref<bool (M::MojoASTDeclRef)>) (/home/benny/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x7ed2a6)
 #9 0x000055c091f982a6 M::Mojo::LSP::MojoDocument::getDocumentSymbols(M::MojoASTDeclRef, std::vector<mlir::lsp::DocumentSymbol, std::allocator<mlir::lsp::DocumentSymbol> >&, llvm::function_ref<bool (M::MojoASTDeclRef)>) (/home/benny/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x7ed2a6)
#10 0x000055c091f9cddc M::Mojo::LSP::MojoTextDocument::onDocumentSymbolSync(mlir::lsp::URIForFile const&) (/home/benny/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x7f1ddc)
#11 0x000055c091fb42ce void llvm::detail::UniqueFunctionBase<void>::CallImpl<void M::Mojo::LSP::MojoDocument::startTaskAfterParsing<M::Mojo::LSP::MojoDocument::onDocumentSymbol(mlir::lsp::URIForFile const&, M::Mojo::LSP::LSPResponder<std::vector<mlir::lsp::DocumentSymbol, std::allocator<mlir::lsp::DocumentSymbol> > >)::$_15>(M::Mojo::LSP::MojoDocument::onDocumentSymbol(mlir::lsp::URIForFile const&, M::Mojo::LSP::LSPResponder<std::vector<mlir::lsp::DocumentSymbol, std::allocator<mlir::lsp::DocumentSymbol> > >)::$_15&&)::'lambda'()>(void*) (/home/benny/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x8092ce)
#12 0x000055c0926f28ea void (anonymous namespace)::WorkQueueThread::runItemsImpl<(anonymous namespace)::WorkQueueThread::runOnThread()::$_0, (anonymous namespace)::WorkQueueThread::runOnThread()::$_1>((anonymous namespace)::WorkQueueThread::runOnThread()::$_0, (anonymous namespace)::WorkQueueThread::runOnThread()::$_1, bool, llvm::StringLiteral, llvm::StringLiteral) (/home/benny/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0xf478ea)
#13 0x000055c0926f2677 (anonymous namespace)::WorkQueueThread::runOnThread() (/home/benny/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0xf47677)
#14 0x00007f450e9e1253 (/lib/x86_64-linux-gnu/libstdc++.so.6+0xdc253)
#15 0x00007f450e750ac3 (/lib/x86_64-linux-gnu/libc.so.6+0x94ac3)
#16 0x00007f450e7e2850 (/lib/x86_64-linux-gnu/libc.so.6+0x126850)
mojo-lsp-server crashed!
Please file a bug report.
[Error - 8:39:09 PM] The Mojo Language Client server crashed 5 times in the last 3 minutes. The server will not be restarted. See the output for more information.
@Benny-Nottonson Benny-Nottonson added bug Something isn't working mojo-repo Tag all issues with this label labels May 20, 2024
@JoeLoser JoeLoser added the crash label May 30, 2024 — with Linear
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working crash Initiative: LSP mojo-repo Tag all issues with this label
Projects
None yet
Development

No branches or pull requests

3 participants