[PATCH] D80525: [clangd] Fix crash-bug in preamble indexing when using modules.

Adam Czachorowski via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Aug 13 07:48:48 PDT 2020


adamcz added a comment.

In D80525#2215755 <https://reviews.llvm.org/D80525#2215755>, @bjope wrote:

> In D80525#2215641 <https://reviews.llvm.org/D80525#2215641>, @adamcz wrote:
>
>> This is quite strange. I can't reproduce this with gcc 7.5.0, 9.3.0 or 10.0.1. Which version are you using?
>>
>> There are bugs around clangd + modules + diagnostics. I'm fixing one in https://reviews.llvm.org/D85753 (not in it's final form yet), but it doesn't seem to be the same issue (can't be sure, but I think this is using the right SourceManager). This test is not supposed to generate any diagnostics, so that's the really surprising bit. Are you building from clean HEAD, or do you have any local modifications that could generate a extra diagnostics in this test?
>>
>> The other option is that the failure is caused by module_cache_path. This test, unlike other clangd tests, needs real file system (to write the .pcm file and then read it back) and perhaps that doesn't work in your jenkins setup.
>>
>> Are there any special options or things unique to your setup I could try out to reproduce this?
>
> We actually have had problems reproducing it outside jenkins ourselves as well. That is kind of why we were a bit clueless about what to do and what might be causing it.
>
> Are those `VFS: failed to set CWD to /clangd-test: No such file or directory` outputs expected?

Yes, they are harmless. InMemoryFS uses fake paths like /clangd-test, but the real file system can't follow that. The real file system is supposed to be used for module cache only.

If you can't reproduce this locally, but can on Jenkins that makes me think it's definitely something with filesystem. I suppose running strace on jenkins to log all FS access is not easy?

Maybe try to figure out what the effective ModuleCachePath is and whether that makes sense (i.e. is accessible) in your Jenkins setup? I can't think of a way to make clangd test log it, but you can just:

  llvm::errs() << ModuleCachePath << "\n"; llvm::errs().flush();

as last line of setModuleCachePath() in clang/lib/clang/Lex/HeaderSearch.h (around line 325) to see what path it's using.  There's probably a much smarter way to do this, but I don't know it.

This is still a random guess that it's something to do with file system.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80525/new/

https://reviews.llvm.org/D80525



More information about the cfe-commits mailing list