LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   GCC crashing machine when accessing swap file (https://www.linuxquestions.org/questions/linux-software-2/gcc-crashing-machine-when-accessing-swap-file-741284/)

tboss888 07-19-2009 10:50 PM

GCC crashing machine when accessing swap file
 
Hi all,

I am trying to pinpoint why my application occasionally crashes the machine when compiling. I have monitored the compile process and it seems that it crashes only when memory is low and it is accessing the swap file.

In googling I found that others have had this problem and it appeared to be caused by the fact that the swap file was located on a different disk than the compiler.

Has anyone else had this problem or know the cause of it?

Thanks.

johnsfine 07-20-2009 04:07 PM

Quote:

Originally Posted by tboss888 (Post 3613343)
In googling I found that others have had this problem and it appeared to be caused by the fact that the swap file was located on a different disk than the compiler.

Do you have any links to those google results?

That answer sounds very unlikely.

With automatic tools rerunning a large number of compiles every day, I have seen a small number of non reproducible crashes of GCC. Those tools run several instances of GCC in parallel, so there is probably some memory pressure when the crashes occur. The tools then automatically rerun the failed compiles one at a time after all the rest are done. The non reproducible crashes of course never reproduce during the automatic individual rerun. Maybe the difference in memory pressure is a factor in the non reproducible results. But I don't know of any direct evidence supporting that guess.

Our swap file is on a local hard drive and the compiler is on an nfs mount. But I don't believe that could be a factor.

In my non reproducible failure I'm sure the swap file is big enough and the other processes run at the same time contained enough that I think I can safely rule out the possibility that there was a simple memory allocation failure triggered by Linux's complex heuristics for over commit limit. But if you see a GCC failure when memory is low, I think that is a cause you should consider:

Tasks can allocate large amounts of "demand zero" memory that take no physical ram and no swap space, but are treated by the kernel as committing memory, so that they might cause the kernel to refuse some later memory allocation request despite having a significant amount of free swap space.

The only possibilities I can think of for the symptom you describe are:
1) Flaky hardware
2) Obscure GCC bug mixed with some obscure way that memory pressure affects GCCs internal heuristics.
3) Linux kernel bug
4) Hitting the over commit limit.

Possibility 4 there is the only clean answer, so I expect it is correct for your problem. I'm pretty sure my non reproducible GCC crashes are possibility 2. That is absurdly unlikely, but in my case the others are more absurdly unlikely (1 is unlikely because the problem has occurred on multiple different computers).


All times are GMT -5. The time now is 09:53 PM.