Project

General

Profile

Actions

Bug #2171

closed

g++ internal compiler error on Ubuntu 14.10

Added by Junxiao Shi about 10 years ago. Updated about 10 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Build
Target version:
Start date:
11/09/2014
Due date:
% Done:

100%

Estimated time:

Description

Build error on Ubuntu 14.10. Jenkins log

[  5/169] Compiling tests/unit-tests/encoding/nfd-constants.cpp

g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.
Actions #1

Updated by Junxiao Shi about 10 years ago

In my experience, although "g++ internal compiler error" is GCC's bug, it's only triggered when certain input is presented to it. If we could found the minimal input that triggers the problem, we could (1) report a bug to GCC (2) modify the snippet to workaround the bug.

Actions #2

Updated by Davide Pesavento about 10 years ago

When did this start to happen?

Actions #3

Updated by Junxiao Shi about 10 years ago

  • Start date changed from 11/12/2014 to 11/09/2014

This problem appears on Nov 09.

To prevent its impact on normal workflow, Ubuntu 14.10 slaves are disabled on the same day.

Actions #4

Updated by Davide Pesavento about 10 years ago

I can't reproduce on 64-bit ubuntu 14.10, are you sure it's not an OOM condition?

Actions #5

Updated by Junxiao Shi about 10 years ago

This might be an Out-Of-Memory condition. I heard that this particular Jenkins slave has some unknown process that consumed half of its memory, so that available memory is around 1GB.

Actions #6

Updated by Junxiao Shi about 10 years ago

  • Status changed from New to In Progress
  • Assignee set to Junxiao Shi

I'll try to reproduce this bug and determine whether it's an out-of-memory condition.

Actions #7

Updated by Junxiao Shi about 10 years ago

  • % Done changed from 0 to 20

I have concluded that this bug is a out-of-memory condition. This conclusion is based on the observation below.

I'm using a Ubuntu 14.10 box with 2GB memory.
In the normal case, the compilation can succeed.
The compilation command used is:

./waf configure --with-tests
./waf -j1

Then I wrote a memory allocation program that allocates a specific amount of memory:

#include <stdlib.h>
#include <stdio.h>

int
main()
{
  void* buf = calloc(768, 1024 * 1024);
  printf("allocated %llx\n", (long long)buf);
  getchar();
  return 0;
}

"768" is the amount of memory, in MB, that this program is going to allocate.

calloc needs to zero the memory, which causes OS to allocate physical memory.

malloc does not cause OS to allocate physical memory until a page is touched, so it shouldn't be used.

Then I executed compilation command while the memory allocation program is running.
By adjusting the amount of memory allocated, three different error messages are observed:

1536MB:

[  2/174] Compiling src/common-pch.hpp
virtual memory exhausted: Cannot allocate memory

1024MB:

[  2/174] Compiling src/common-pch.hpp

cc1plus: out of memory allocating 67108864 bytes after a total of 215019520 bytes

768MB:

[  5/174] Compiling tests/unit-tests/encoding/nfd-constants.cpp

g++: internal compiler error: Segmentation fault (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See <file:///usr/share/doc/gcc-4.9/README.Bugs> for instructions.

The third error message matches the one in this Bug report.

Actions #8

Updated by Junxiao Shi about 10 years ago

  • % Done changed from 20 to 30

Proposed solution:

  • in INSTALL.rst "Prerequisites" section, add "1.5GB available memory"
  • in INSTALL.rst "Build" and "Development Build" section, change ./waf to ./waf -j1

I have tested that compilation can succeed if the memory allocation program takes away 512MB, so "1.5GB" is recommended.

Actions #9

Updated by Alex Afanasyev about 10 years ago

./waf -j1 should be recommended only on machines with low memory. Other than that, I have no problems making the change in INSTALL.rst.

Actions #10

Updated by Davide Pesavento about 10 years ago

Alex Afanasyev wrote:

./waf -j1 should be recommended only on machines with low memory. Other than that, I have no problems making the change in INSTALL.rst.

+1

Actions #11

Updated by Junxiao Shi about 10 years ago

  • % Done changed from 30 to 70
Actions #12

Updated by Junxiao Shi about 10 years ago

  • Category changed from Base to Build
Actions #13

Updated by Junxiao Shi about 10 years ago

  • Assignee changed from Junxiao Shi to Yi Huang

I'm reassigning this issue to @Yi.

System processes on Ubuntu 14.10 slaves take 1GB memory.
Thus, total memory on these slaves shall be set to 2560MB, so that there are 1.5GB available memory for compilation, as recommended by the new documentation.

Actions #14

Updated by Yi Huang about 10 years ago

Done. Now those two slaves have total memory of 2560MB.

slave-14.10-1 Memory size: 2560MB
slave-14.10-2 Memory size: 2560MB
Actions #15

Updated by Junxiao Shi about 10 years ago

Job configuration needs to be updated so that projects are built with Ubuntu 14.10 slaves.

Actions #16

Updated by Yi Huang about 10 years ago

I have added Ubuntu-14.10 to ndn-cxx and NFD.

Actions #17

Updated by Junxiao Shi about 10 years ago

  • Status changed from In Progress to Resolved
  • % Done changed from 70 to 100

This Bug can close after 7 days if there's no more such failure.

Actions #18

Updated by Junxiao Shi about 10 years ago

  • Status changed from Resolved to Closed
Actions

Also available in: Atom PDF