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 crashes when setting up compilation database via initialization options #926
Comments
can you invoke clangd with As you mentioned it looks like this is happening as soon as clangd tries to invoke the unique_function stored at It would also be worth trying to build clangd with a different compiler (if the crash goes away, it's probably a UB/bug inside the unique_function/compiler). |
verbose-log.txt I've attached the verbose log and the full stack trace from the core dump. Let me know if you want me to examine the core dump in some other way. |
Rebuilding with clang (instead of gcc) did not help, and neither did using libc++. |
It'd be great if you could print the state of |
pretty_printed_state_at_onBackgroundIndexProgress.txt Here's the pretty-printed state of onBackgroundIndexProgress() right before the crashing call to CreateWorkDoneProgress() (as shown in Qt Creator's debug window). Regarding the state after binding: Since live debugging will probably a bit cumbersome (e.g. because I don't know in advance whether this instance will crash), I suppose inserting logging statements is the way to go here. Can you provide a small patch or code snippet that prints the values you are interested in? |
Oh dear, this one is silly and my fault... On startup we bind "initialize" only, and delay binding the rest of LSP until initialization. An aside: I assume you do want background indexing to happen for the files you specify in initializationOptions? And the list might be big? I think applyConfiguration is pretty slow for a big list of changes, we apply them one at a time, doing a bit of work and locking to enqueue each one. Worse, we do it on the main thread. This might slow down startup. We can fix it though. |
Yes on both counts. Once the crash is gone, I can check whether we observe a noticeably delayed startup. We'd really like to get rid of the JSON file redirection on the client side. |
Our client (Qt Creator) currently creates a compilation database file and passes its path to clangd via the --compile-commands-dir command line switch. We'd like to skip creating that file and pass the commands to clangd directly via initializationOptions.compilationDatabaseChanges. In addition, because we still want to keep control over the index location, we also use initializationOptions.compilationDatabasePath, which points to a minimal JSON file containing an empty array. It is my understanding that these get merged into a single compilation database.
However, after doing this, clangd often crashes, apparently while setting up the background indexing progress message. The stack trace always looks like this:
stderr output from clangd --verbose:
(followed by the stack trace above)
The concrete file content does not seem to matter.
The text was updated successfully, but these errors were encountered: