Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build fails with --enable-asan --ninja on Ubuntu 18.04 #32257

Closed
gabrielschulhof opened this issue Mar 14, 2020 · 14 comments
Closed

build fails with --enable-asan --ninja on Ubuntu 18.04 #32257

gabrielschulhof opened this issue Mar 14, 2020 · 14 comments
Labels
build Issues and PRs related to build files or the CI.

Comments

@gabrielschulhof
Copy link
Contributor

Linking cctest fails with errors of the form below referring to many symbols:

`_ZZN4node14ThreadPoolWorkC4EPNS_11EnvironmentEE19__PRETTY_FUNCTION__' referenced in
section `.data.rel.local' of obj/src/libnode.node_api.o: defined in discarded section 
`.rodata._ZZN4node14ThreadPoolWorkC4EPNS_11EnvironmentEE19__PRETTY_FUNCTION__[_ZZN4node14ThreadPoolWorkC4EPNS_11EnvironmentEE4args]' 
of obj/src/libnode.node_api.o
@gabrielschulhof
Copy link
Contributor Author

@gabrielschulhof gabrielschulhof added the build Issues and PRs related to build files or the CI. label Mar 14, 2020
@gabrielschulhof
Copy link
Contributor Author

gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0

@sam-github
Copy link
Contributor

I suggest reverting #31902 in #32324

@mmarchini
Copy link
Contributor

@gabrielschulhof did you get this error on GitHub Actions on your machine?

@FullyArticulate
Copy link

Same error here, and I'm not using GIthub actions.

@mmarchini
Copy link
Contributor

@FullyArticulate @gabrielschulhof can you share more on the error output? This could be the same as our GitHub Actions issue (not enough memory to link) or could be something else. On my machine it's building fine (Ubuntu 19.10, gcc (Ubuntu 9.2.1-9ubuntu2) 9.2.1 20191008).

Note: test runs will fail, our codebase is not ASAN compliant yet. But cctest builds just fine here.

@richardlau
Copy link
Member

Linking cctest fails with errors of the form below referring to many symbols:

`_ZZN4node14ThreadPoolWorkC4EPNS_11EnvironmentEE19__PRETTY_FUNCTION__' referenced in
section `.data.rel.local' of obj/src/libnode.node_api.o: defined in discarded section 
`.rodata._ZZN4node14ThreadPoolWorkC4EPNS_11EnvironmentEE19__PRETTY_FUNCTION__[_ZZN4node14ThreadPoolWorkC4EPNS_11EnvironmentEE4args]' 
of obj/src/libnode.node_api.o

Same error in https://github.com/nodejs/node/pull/32352/checks#step:4:3938 that was run for #32352.

@mmarchini
Copy link
Contributor

That's an out of memory error (the important line is collect2: ...). Users can double-check that's the case with dmesg, there will be a kernel message saying ld was killed to free memory.

I don't think there's anything we can do to fix this on developers machines. ASAN (just as Debug) builds are heavy, and linking requires a lot of memory. I've solved it on other projects by using less parallelism (a lower -jN number).

@gengjiawen
Copy link
Member

I have run ASAN checks on a 16GB machine, works fine. I think it's a issue related to gcc or other toolchain. @gabrielschulhof Can you try run asan in docker image gengjiawen/node-build:2020-02-14, it's our current CI using now.

sam-github added a commit to sam-github/node that referenced this issue Mar 19, 2020
@mmarchini
Copy link
Contributor

@gengjiawen I tried with the image limiting the memory available for the container (docker run -m 7g ...) and I got the same failure, which means if the host doesn't have enough memory, it will cause the same failure.

Also, users trying to build ASAN on Docker on OS X will probably have a hard time, since Docker on OS X runs on top of a Linux VM with 2Gb Ram by default (unless they changed the default recently). Not sure if that's the case here, but I thought it was worth mentioning.

@gengjiawen
Copy link
Member

on Github Action the memory error is

FAILED: mkcodecache 
c++ -fsanitize=address -pthread -rdynamic -m64 -Wl,--whole-archive obj/deps/zlib/libzlib.a -Wl,--no-whole-archive -Wl,--whole-archive obj/deps/uv/libuv.a -Wl,--no-whole-archive -Wl,-z,noexecstack -Wl,--whole-archive obj/tools/v8_gypfiles/libv8_snapshot.a -Wl,--no-whole-archive -Wl,-z,relro -Wl,-z,now -Wl,--whole-archive,obj/deps/openssl/libopenssl.a -Wl,--no-whole-archive -pthread -o mkcodecache -Wl,--start-group obj/src/mkcodecache.node_snapshot_stub.o obj/src/mkcodecache.node_code_cache_stub.o obj/tools/code_cache/mkcodecache.mkcodecache.o obj/tools/code_cache/mkcodecache.cache_builder.o obj/libnode.a obj/deps/histogram/libhistogram.a obj/deps/uvwasi/libuvwasi.a obj/tools/v8_gypfiles/libv8_snapshot.a obj/tools/v8_gypfiles/libv8_libplatform.a obj/tools/icu/libicui18n.a obj/deps/zlib/libzlib.a obj/deps/llhttp/libllhttp.a obj/deps/cares/libcares.a obj/deps/uv/libuv.a obj/deps/nghttp2/libnghttp2.a obj/deps/brotli/libbrotli.a obj/deps/openssl/libopenssl.a obj/tools/icu/libicuucx.a obj/tools/icu/libicudata.a obj/tools/v8_gypfiles/libv8_base_without_compiler.a obj/tools/v8_gypfiles/libv8_libbase.a obj/tools/v8_gypfiles/libv8_libsampler.a obj/tools/v8_gypfiles/libv8_zlib.a obj/tools/v8_gypfiles/libv8_compiler.a obj/tools/v8_gypfiles/libv8_initializers.a  -lm -ldl -Wl,--end-group
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
##[error]Process completed with exit code 1.

Not like the error @gabrielschulhof posted. Maybe not the same problem ?

@mmarchini
Copy link
Contributor

Correct me if I'm wrong, but the "referenced in section..." message looks like a warning, not an error. And that line is also present in the CI:

img-2020-03-19-175704

@gengjiawen
Copy link
Member

In this case, it looks like the memory issue. I don't is there a way to improve this. But for now, a big memory machine is needed for ASAN build.

mmarchini pushed a commit that referenced this issue Mar 22, 2020
This reverts commit 3ec4b21.

See: #32257

PR-URL: #32324
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
MylesBorins pushed a commit that referenced this issue Mar 24, 2020
This reverts commit 3ec4b21.

See: #32257

PR-URL: #32324
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
MylesBorins pushed a commit that referenced this issue Mar 24, 2020
This reverts commit 3ec4b21.

See: #32257

PR-URL: #32324
Reviewed-By: Matheus Marchini <mat@mmarchini.me>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
Reviewed-By: Gabriel Schulhof <gabriel.schulhof@intel.com>
@gengjiawen
Copy link
Member

This is fixed by @mmalecki patch for gyp.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
build Issues and PRs related to build files or the CI.
Projects
None yet
Development

No branches or pull requests

6 participants