[cfe-dev] Clang 'locks up' when compiling optimized
David Barto via cfe-dev
cfe-dev at lists.llvm.org
Wed Jun 28 08:31:01 PDT 2017
I’m going to disable (for the MacOS Builds) the memory limit checks for the time being.
Should I register a bug about this or is there someone with ‘more authority’ who would be more appropriate?
David
> On Jun 28, 2017, at 8:29 AM, Brian Cain <brian.cain at gmail.com> wrote:
>
> Hmm, yes, I didn't notice that in the backtrace but you're right.
>
> I don't think "assume infinite resources" is the bug though. malloc()'s not signal-safe on linux, so it probably isn't on MacOS either. We shouldn't be calling malloc() from the signal handler.
>
> As a practical matter, maybe this is a feature that you could disable either at build-time or runtime?
>
> On Wed, Jun 28, 2017 at 10:25 AM, David Barto <barto at cambridgesemantics.com <mailto:barto at cambridgesemantics.com>> wrote:
> Looks like the bug is that the crash handler is attempting to allocate memory, and the reason it was crashing was that it ran out of memory.
>
> Sounds like a real clang issue to deal with as the compiler should not assume infinite resources.
>
> David
>
>> On Jun 28, 2017, at 8:18 AM, Brian Cain <brian.cain at gmail.com <mailto:brian.cain at gmail.com>> wrote:
>>
>> On Wed, Jun 28, 2017 at 10:10 AM, David Barto <barto at cambridgesemantics.com <mailto:barto at cambridgesemantics.com>> wrote:
>> This is part of an in-memory system (no swap space configured) so RSS would match the AS size for this use case. From what I read about RSS and AS for MacOS and Linux.
>>
>> Why did it lock up, why not throw the exception and exit?
>>
>>>
>>
>>
>> Dunno, it seems like the OS is driving now and it's not immediately clear to me why that system call wouldn't yield either success or failure. But clang is asking for a resource (more memory), and I've seen those stall before. My experience with linux (may or may not be applicable) leads me to believe that the system is perhaps resource-constrained and your task is pending while it tries to free up those resources.
>>
>> RLIMIT_AS and RLIMIT_RSS are distinct on linux, I guess I am a little surprised to see that they're not on MacOS.
>>
>> In any case, the most likely culprit is your setrlimit. If I were you I would take clang out of the loop entirely and write a test program that does allocations just like the ones clang does (various sized mallocs, you could try profiling to get a ballpark histogram). I would be surprised if you don't see the same behavior.
>>
>> -Brian
>
> David Barto
> barto at cambridgesemantics.com <mailto:barto at cambridgesemantics.com>
>
> Sometimes, my best code does nothing. Most of the rest of it has bugs.
>
>
>
>
>
>
> --
> -Brian
David Barto
barto at cambridgesemantics.com
Sometimes, my best code does nothing. Most of the rest of it has bugs.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20170628/62212463/attachment.html>
More information about the cfe-dev
mailing list