AlexMasterov / dockerfiles

:whale: Common Dockerfiles, used for development
56 stars 18 forks source link

alpine-libv8 Error during ninja build #7

Closed TobiasGruenhagen closed 7 years ago

TobiasGruenhagen commented 7 years ago

When building the docker file an error occurs at the end of the ninja build process. I build on a vagrant virtualbox VM with Alpine Linux v3.6.0 and 4GB RAM. I also tested the docker build on a standard installation of Alpine Linux on an extra partition on my machine. The same following error occurs:

[1007/1025] ACTION //:run_mksnapshot(//build/toolchain/linux:x64)
FAILED: gen/snapshot.cc 
python ../../tools/run.py ./mksnapshot --startup_src gen/snapshot.cc --random-seed 314159265

<--- Last few GCs --->

#
# Fatal javascript OOM in CALL_AND_RETRY_LAST
#

Received signal 4 ILL_ILLOPN 66e07c29eec9
[end of stack trace]

When executing the mksnapshot file afterwards on its own, i get the following error output:

Starting program: /home/gruenhag/apkbuilds/v8/src/v8/out.gn/x64.release/mksnapshot 
warning: Cannot call inferior functions, Linux kernel PaX protection forbids return to non-executable pages!
[New LWP 29994]
[New LWP 29995]
[New LWP 29996]

<--- Last few GCs --->

[29990:0x6c5abc1e000] 24164184 ms: Mark-sweep 0.1 (3.0) -> 0.1 (3.0) MB, 0.2 / 0.0 ms  allocation failure GC in old space requested
[29990:0x6c5abc1e000] 24164185 ms: Mark-sweep 0.1 (3.0) -> 0.1 (3.0) MB, 0.1 / 0.0 ms  last resort 
[29990:0x6c5abc1e000] 24164185 ms: Mark-sweep 0.1 (3.0) -> 0.1 (3.0) MB, 0.1 / 0.0 ms  last resort 

<--- JS stacktrace --->

#
# Fatal javascript OOM in CALL_AND_RETRY_LAST
#

Thread 1 "mksnapshot" received signal SIGILL, Illegal instruction.
0x00006bfa33a64ec9 in ?? ()
(gdb) bt
#0  0x00006bfa33a64ec9 in ?? ()
#1  0x000006c5a846b42b in v8::Utils::ReportOOMFailure(char const*, bool) ()
#2  0x000006c5a846b630 in v8::internal::V8::FatalProcessOutOfMemory(char const*, bool) ()
#3  0x000006c5a8829791 in v8::internal::Factory::NewCode(v8::internal::CodeDesc const&, unsigned int, v8::internal::Handle<v8::internal::Object>, bool, bool, int, bool) ()
#4  0x000006c5a8583595 in v8::internal::PlatformCodeStub::GenerateCode() ()
#5  0x000006c5a858a9d0 in v8::internal::CodeStub::GetCode() ()
#6  0x000006c5a8c1ef1a in v8::internal::MacroAssembler::TailCallRuntime(v8::internal::Runtime::FunctionId) ()
#7  0x000006c5a8c73226 in v8::internal::(anonymous namespace)::BuildWithMacroAssembler(v8::internal::Isolate*, void (*)(v8::internal::MacroAssembler*), unsigned int, char const*) [clone .constprop.28] ()
#8  0x000006c5a8c73a19 in v8::internal::SetupIsolateDelegate::SetupBuiltinsInternal(v8::internal::Isolate*) ()
#9  0x000006c5a891dbf8 in v8::internal::Isolate::Init(v8::internal::Deserializer*) ()
#10 0x000006c5a8473910 in v8::SnapshotCreator::SnapshotCreator(long*, v8::StartupData*) ()
#11 0x000006c5a847a7cd in v8::V8::CreateSnapshotDataBlob(char const*) ()
#12 0x000006c5a8460356 in main ()

If i run the build process without using snapshot the build process works but executing d8 gives the same error shown before. I tried several GN-/Ninja-build-options without any effort. Do you have any idea why this error occurs and how to solve it?

AlexMasterov commented 7 years ago

What version of V8 you're trying to build? I had a look at the log on automated build, it gets past this step no problems.

@pinepain, do you have any ideas on what else it might be?

It seems that the process run out of memory (OOM).

Try to increase the RAM-memory assigned to a virtual machine (2048 is fine). Try to limit the number of concurrent cores/jobs/links; by Ninja options like "-j N" and "-l N", V8 options like "concurrent_links".

Looks like this is not helping.

pinepain commented 7 years ago

@TobiasGruenhagen Looks a bit odd. Maybe try to add/increase swap? I normally had at least 4Gb and 512Mb swap and it worked ok. As the last resort, giving a try to more recent v8 version may solve an issue.

@AlexMasterov I see that you checkout php-v8 from master, make sure to have up to date libv8, I raise it version time to time, currently you will need at least 6.1.170. In general, you can get current required min version from https://github.com/pinepain/php-v8/blob/master/config.m4#L11 from V8_MIN_API_VERSION_STR variable which looks like V8_MIN_API_VERSION_STR=6.1.170 atm.

TobiasGruenhagen commented 7 years ago

I finally resolved the issue with strace. It was a privilege error due to PaX. I used paxmark -m mksnapshot and paxmark -m d8 to resolve the errors. I will try to build it in the build process now.