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

clangd does not clean up after itself #266

Closed
DrZingo opened this issue Jun 14, 2021 · 4 comments · Fixed by #287
Closed

clangd does not clean up after itself #266

DrZingo opened this issue Jun 14, 2021 · 4 comments · Fixed by #287
Labels
A-language-server Area: Language server client C-bug Category: This is a bug

Comments

@DrZingo
Copy link
Contributor

DrZingo commented Jun 14, 2021

clangd leaves precompiled headers in /tmp after close.

Reproduction steps

Have clangd installed
Open a cpp or c file
Close helix
A preamble-xxxxxx.pch is left in /tmp
Repeat from first step, and a new pch is created every time.
This could potentially fill up a tmp partition quite fast if you have a project with many headers.

Environment

Arch linux
hx --version: 0.2.0 (no, I'm using 0.2.1)

When vim is closed, clangd does remove it's pch files. Maybe clangd is started differently or closed unclean in helix?

Great project btw, love it!

@DrZingo DrZingo added the C-bug Category: This is a bug label Jun 14, 2021
@pickfire pickfire added the A-language-server Area: Language server client label Jun 15, 2021
@archseer archseer mentioned this issue Jun 16, 2021
@archseer
Copy link
Member

I think the root cause might be the same as #278, we don't properly signal a shutdown to the LSP. This doesn't matter for some LSP servers because the analysis is stored in memory, but it does make a difference for clangd

@DrZingo
Copy link
Contributor Author

DrZingo commented Jun 19, 2021

Bumping this again.
I clean built helix from git (helix-git from arch AUR) 30 minutes before the log. With some files the .pch file got removed from /tmp and with other files it's not. I couldn't pinpoint when working and when not, so here is a log of xsol.c which cleans, and then sol.c which doesn't.
clangd is a clean install from arch default repo with no extra configurations.
helix.log
Let me know if there is more I can do.

@vv9k
Copy link
Contributor

vv9k commented Jun 20, 2021

I was able to replicate this, i'm not entirely sure it's helix fault here. I opened /usr/include/wx-3.0/wx/arrimpl.cpp from wx3.0 and after a few open/close there was a file left in /tmp. What is weird my log says that the lsp finished exiting with status 0 which means it correctly got our request to shutdown and exit and handled it but left the file.

2021-06-20T06:42:26.031 helix_view::editor [WARN] shutting down language servers
2021-06-20T06:42:26.031 helix_lsp::client [WARN] shutting down server 0
2021-06-20T06:42:26.031 helix_lsp::transport [ERROR] err <- I[06:42:26.031] <-- shutdown(1)

2021-06-20T06:42:26.031 helix_lsp::transport [ERROR] err <- I[06:42:26.031] --> reply:shutdown(1) 0 ms

2021-06-20T06:42:26.031 helix_lsp::transport [ERROR] err <- I[06:42:26.031] <-- exit

2021-06-20T06:42:26.031 helix_lsp::transport [ERROR] err <- I[06:42:26.031] LSP finished, exiting with status 0

@DrZingo
Copy link
Contributor Author

DrZingo commented Jun 28, 2021

It is not clangd's fault anyway. It only happens with helix, and it still happens 9 out of 10 times when files have errors. I could not replicate it with /usr/include/wx-3.0/wx/arrimpl.cpp though.
Remove some includes and you will have preambles left in tmp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-language-server Area: Language server client C-bug Category: This is a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants