[cfe-dev] ModuleCache issues on Linux (Ubuntu)

David Blaikie via cfe-dev cfe-dev at lists.llvm.org
Mon Mar 15 10:16:09 PDT 2021


Ping, especially curious to hear from Richard - I thought we speculated
about this issue a few years ago, so hopefully he's got some context.

On Mon, Mar 1, 2021 at 10:38 AM Ilya Kuteev <ilyakuteev at yandex-team.ru>
wrote:

> I figured out that the problem is in reading PCM files using FileManager.
> clang/lib/Basic/FileManager.cpp:271
> ```
> FileEntry &UFE = UniqueRealFiles[Status.getUniqueID()];
> ```
> If I remove this cache everything is OK.
> Seems like inode is shared between deleted/edited and newly created PCM
> file.
> If it happens FileManager returns a FileEntryRef to an invalid file.
>
> How can I fix this issue? Maybe we need to remove UniqueRealFiles cache
> for PCM files, or make it work with this case?
>
>
> 1 марта 2021 г., в 20:13, David Blaikie <dblaikie at gmail.com> написал(а):
>
> Can't say any of this sounds especially familiar to me - cc'd a few folks
> who might have some context.
>
> On Fri, Feb 19, 2021 at 6:28 AM Ilya Kuteev via cfe-dev <
> cfe-dev at lists.llvm.org> wrote:
>
>> Hello everyone!
>>
>> I've ran into a strange problem using clang-modules on Linux. I have a Linux machine running Ubuntu 18.04.4 LTS.
>>
>> When I put my ModuleCache on RAM everything is OK
>>
>> When I put ModuleCache on SSD/HDD, very frequently I'm getting different errors with pcm files, like below:
>>
>> ```
>>
>> fatal error: module file '/home/ilyakuteev/module_cache/2/1721172304169885905/3OA4HVRBFA8AJ/Base-5W2XL4QH4QAH.pcm' is out of date and needs to be rebuilt: signature mismatch
>>
>> ```
>>
>>
>> ```
>>
>> fatal error: malformed or corrupted AST file: 'Unexpected end of file reading 4154469704 of 4738416 bytes'
>>
>> note: after modifying system headers, please delete the module cache at '/home/ilyakuteev/module_cache/1721172304169885905/37WO4K6LHZNB5'
>>
>> fatal error: error in backend: Invalid abbrev number
>>
>> ```
>>
>>
>> ```
>>
>> fatal error: malformed or corrupted AST file: 'declaration ID out-of-range for AST file'
>>
>> note: after modifying system headers, please delete the module cache at '/home/ilyakuteev/module_cache/3/1721172304169885905/1907ERGA34IRD'
>>
>> ```
>>
>>
>> I’ve done some research and it looks like the failure is inside single clang process, clang writes pcm down on disk, then reads it and gets a malformed file back, or some other problem with reading on-disk pcm.
>>
>>
>> I've found a patch https://reviews.llvm.org/D22636 and it looks like it fixes my problems, but I don’t want to use it, cause it just rebuilts "owned" module if its AST is corrupted and looks like retry of operation, not a real fix. Also this fix introduces some unstable behavior.
>>
>>
>> My questions:
>>
>> 1) Is this a known problem?
>>
>> 2) How can I safely hot-fix it before it will be fixed in clang?
>>
>> 3) Do I need to provide more logs for this issue to be fixed?
>>
>>
>> Thanks
>>
>>
>> _______________________________________________
>> cfe-dev mailing list
>> cfe-dev at lists.llvm.org
>> https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20210315/f2a43c94/attachment-0001.html>


More information about the cfe-dev mailing list