modularml / mojo

The Mojo Programming Language
https://docs.modular.com/mojo/manual/
Other
22.92k stars 2.58k forks source link

[BUG]: mojo-lsp-server: /__w/modular/modular/third-party/llvm-project/llvm/include/llvm/Support/JSON.h:318: llvm::json::Value::Value(std::string): Assertion `false && "Invalid UTF-8 in value used as JSON"' failed #1897

Open davidxiaozhi opened 6 months ago

davidxiaozhi commented 6 months ago

Bug description

mojo-lsp-server: /__w/modular/modular/third-party/llvm-project/llvm/include/llvm/Support/JSON.h:318: llvm::json::Value::Value(std::string): Assertion `false && "Invalid UTF-8 in value used as JSON"' failed. 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 0x0000556ca205fd37 (/home/admin/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x428d37)

1 0x0000556ca205d90e (/home/admin/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x42690e)

2 0x0000556ca205f113 (/home/admin/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x428113)

3 0x0000556ca202aa68 (/home/admin/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x3f3a68)

4 0x00007f368533a520 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x42520)

5 0x00007f368538e9fc pthread_kill (/usr/lib/x86_64-linux-gnu/libc.so.6+0x969fc)

6 0x00007f368533a476 gsignal (/usr/lib/x86_64-linux-gnu/libc.so.6+0x42476)

7 0x00007f36853207f3 abort (/usr/lib/x86_64-linux-gnu/libc.so.6+0x287f3)

8 0x00007f368532071b (/usr/lib/x86_64-linux-gnu/libc.so.6+0x2871b)

9 0x00007f3685331e96 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x39e96)

10 0x0000556ca219cdae (/home/admin/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x565dae)

11 0x0000556ca21a2fd9 (/home/admin/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x56bfd9)

12 0x0000556ca219d37b (/home/admin/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x56637b)

13 0x0000556ca1fd1ba7 (/home/admin/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x39aba7)

14 0x0000556ca1fdfa36 (/home/admin/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0x3a8a36)

15 0x0000556ca2810707 (/home/admin/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0xbd9707)

16 0x0000556ca2810421 (/home/admin/.modular/pkg/packages.modular.com_mojo/bin/mojo-lsp-server+0xbd9421)

17 0x00007f368561f253 (/usr/lib/x86_64-linux-gnu/libstdc++.so.6+0xdc253)

18 0x00007f368538cac3 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x94ac3)

19 0x00007f368541e850 (/usr/lib/x86_64-linux-gnu/libc.so.6+0x126850)

[Error - 3:43:20 AM] 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.

Steps to reproduce

System information

- What OS did you do install Mojo on ?  linux
- Provide version information for Mojo by pasting the output of `mojo -v`  24.1
- Provide Modular CLI version by pasting the output of `modular -v` 0.5.1
davidxiaozhi commented 6 months ago

@richardkiss @scw @dlumma @prabhuramachandran Whether there is a temporary solution to fix the problem

iamtimdavis commented 6 months ago

@River707 and @walter-erquinigo as FYI

walter-erquinigo commented 6 months ago

@davidxiaozhi , thanks for the report! Could you share the source code of the file that caused the issue in the LSP?

davidxiaozhi commented 6 months ago

@walter-erquinigo @iamtimdavis I am sorry that I cannot upload the source code file, but I have located the problem, which is caused by special invisible characters in the """ """" format comment. Deleting the comment content of a specific line or replacing """ """" with multiple # can also solve the problem

walter-erquinigo commented 6 months ago

@davidxiaozhi , thanks for the prompt reply! Could you share a minimal mojo file with that invisible character so that I can reproduce locally? I'm asking because I'm having difficulties replicating that exact situation.

gryznar commented 6 months ago

@davidxiaozhi crash is still a crash. Protecting against that will be helpful for other users with such problem. Task should not be closed until fixing it

davidxiaozhi commented 6 months ago

@walter-erquinigo @iamtimdavis this is a crash demo crash.mojo.txt

walter-erquinigo commented 6 months ago

This is a parser issue for sure. I'll take a look soon.