Bug 1825593 - clangd crashes when indexing some projects
Summary: clangd crashes when indexing some projects
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: clang
Version: 31
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: serge_sans_paille
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2020-04-19 08:22 UTC by Ricardo Garcia
Modified: 2020-10-31 02:01 UTC (History)
9 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2020-06-11 14:52:01 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ricardo Garcia 2020-04-19 08:22:57 UTC
Description of problem:

I'm trying to use clangd to work on VK-GL-CTS (https://github.com/KhronosGroup/VK-GL-CTS) using Visual Studio Code, in order not to depend so much on the proprietary C/C++ IntelliSense pluging from Microsoft. However, clangd crashes several times while trying to index the project and cannot index it properly.

The crash looks similar to this reported issue:
https://github.com/clangd/clangd/issues/265

In that thread, you can see a patch appearing to solve the issue is proposed here:
https://github.com/clangd/clangd/issues/265#issuecomment-580173854

I have built clangd 9.0.1 from sources with and without that patch and, indeed, crashes happen without the fix and then stop with the fix applied when indexing VK-GL-CTS.

Furthermore, a similar one-liner fix seems to have already landed on LLVM master:
https://github.com/llvm/llvm-project/commit/ad7211df6f257e39da2e5a11b2456b4488f32a1e

But it doesn't seem to be present in the 9.x branch:
https://github.com/llvm/llvm-project/blob/release/9.x/clang/lib/AST/RawCommentList.cpp#L413

I would like to request applying a similar one-liner patch to the Fedora-shipped clangd 9.0.1 in Fedora 31.


Version-Release number of selected component (if applicable):
clang-tools-extra-9.0.1-2.fc31.x86_64

How reproducible:
Always.

Steps to Reproduce:
1. Build deqp-vk from VK-GL-CTS following these instructions: https://github.com/KhronosGroup/VK-GL-CTS/tree/3c12deb6000947c6a94809c99cd4ae68e1839262/external/vulkancts#linux-32-bit-debug (remembering to add -DCMAKE_EXPORT_COMPILE_COMMANDS=1 to the cmake call).
2. Symlink compile_commands.json in the root directory.
3. Try to index the project using clangd.

Actual results:
clangd crashes several times and is unable to index the project.

Expected results:
clangd indexes the project successfully.

Additional info:

Comment 1 serge_sans_paille 2020-04-20 09:30:01 UTC
The patch didn't even land in llvm 10.0.0, so it's not even applied on rawhide. I've suggested it for 10.0.1 here https://bugs.llvm.org/show_bug.cgi?id=45615

Comment 2 Ricardo Garcia 2020-04-23 20:48:51 UTC
(In reply to serge_sans_paille from comment #1)
> The patch didn't even land in llvm 10.0.0, so it's not even applied on
> rawhide. I've suggested it for 10.0.1 here
> https://bugs.llvm.org/show_bug.cgi?id=45615

Excellent, thanks! Do you have an ETA for patched Fedora packages?

Comment 3 serge_sans_paille 2020-04-24 08:25:44 UTC
Well, we'll wait until the minor llvm10 release, so that's generally a matter of months after the major release, but this major release got delayed a lot, so I can't tell for sure.

Comment 4 Ricardo Garcia 2020-04-24 17:56:24 UTC
That's disappointing to hear. Taking into account this is a harmless one-liner patch that fixes a known crash and was added upstream, wouldn't it make more sense to backport it to both Fedora 31 (shipping 9.0.1) and Fedora 32 in the mean time as a package patch? That way Fedora users can receive the fix now rather than having to wait for months.

Comment 5 Cristian Morales Vega 2020-05-07 13:36:28 UTC
After updating to Fedora 32 I have given another try to clangd and found this issue. A backport in the Fedora package until 10.0.1 would be indeed appreciated.

Comment 6 serge_sans_paille 2020-05-07 14:04:06 UTC
ok, I'll wait for it to be accepted to 10.0.1 and once it's OK, I'll backport the patch.

Comment 7 Cristian Morales Vega 2020-05-08 10:13:00 UTC
FWIW I have added the patch in https://copr.fedorainfracloud.org/coprs/reddwarf/personal/. I have started to use it in VSCode and no complains so far.

Comment 8 Cristian Morales Vega 2020-05-10 08:22:04 UTC
FWIW I have ended up also adding https://github.com/llvm/llvm-project/commit/9a5c448a31bacc08e73fcae4636094f9b6e2be6a to my copr because it's also a crash bug (https://github.com/clangd/clangd/issues/378).

Comment 9 Ricardo Garcia 2020-05-10 18:05:12 UTC
Thanks for the packages and the COPR idea! I've built a COPR package with the patch for Fedora 31 so others can test it too: https://copr.fedorainfracloud.org/coprs/rg3/clang/

Comment 10 Jean Guegant 2020-05-12 20:05:39 UTC
I had a similar issue with Fedora 32. It is great to see that issue has been identified and a fix for it is available.
On the other hand it is a bit sad to hear that this could take months to be fixed.
It makes clangd unusable for big projects. The probability that one header somewhere has an empty comment is actually fairly high.
I resorted to compile clangd / LLVM 11 manually for now which is not so ideal either.

Comment 11 serge_sans_paille 2020-05-19 13:06:02 UTC
The fix has been accepted for 10.0.1, I'll bacport it now for rawhide and f32/f31

Comment 12 serge_sans_paille 2020-05-20 06:26:10 UTC
Available as clang-10.0.0-2.fc33.src.rpm

Comment 13 Fedora Update System 2020-05-25 07:14:50 UTC
FEDORA-2020-f415dc8466 has been submitted as an update to Fedora 32. https://bodhi.fedoraproject.org/updates/FEDORA-2020-f415dc8466

Comment 14 Fedora Update System 2020-05-25 12:34:31 UTC
FEDORA-2020-3a5df7ae7d has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-3a5df7ae7d

Comment 15 Fedora Update System 2020-05-26 04:40:59 UTC
FEDORA-2020-f415dc8466 has been pushed to the Fedora 32 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-f415dc8466`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-f415dc8466

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 16 Fedora Update System 2020-05-26 04:56:56 UTC
FEDORA-2020-3a5df7ae7d has been pushed to the Fedora 31 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-3a5df7ae7d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-3a5df7ae7d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 17 Ricardo Garcia 2020-05-30 19:45:17 UTC
Thanks a lot for both updates. I have tested both (Fedora 32 and 31) and they allow me to index VK-GL-CTS properly with no more crashes. I've left feedback in Bodhi.

Comment 18 Fedora Update System 2020-06-07 19:46:37 UTC
FEDORA-2020-f415dc8466 has been pushed to the Fedora 32 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 19 Fedora Update System 2020-09-14 08:47:26 UTC
FEDORA-2020-3a2812cd4d has been submitted as an update to Fedora 31. https://bodhi.fedoraproject.org/updates/FEDORA-2020-3a2812cd4d

Comment 20 serge_sans_paille 2020-09-14 12:02:43 UTC
@Riccardo, the f31 version was stalling, I resubmitted that update alongside another bugfix.

Comment 21 Fedora Update System 2020-09-14 14:09:54 UTC
FEDORA-2020-3a2812cd4d has been pushed to the Fedora 31 testing repository.
In short time you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2020-3a2812cd4d`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2020-3a2812cd4d

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 22 Fedora Update System 2020-10-31 02:01:42 UTC
FEDORA-2020-3a2812cd4d has been pushed to the Fedora 31 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.