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

Scylladb: fix build under sandboxing #70576

Merged
merged 3 commits into from Oct 10, 2019

Conversation

workflow
Copy link
Contributor

@workflow workflow commented Oct 7, 2019

Motivation for this change

Build was broken under sandboxing.
This fixes two build nondeterminisms

CC: @clojurians-org @erictapen

Resolves #70049

Also ticks one of the boxes in #68361

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@workflow
Copy link
Contributor Author

workflow commented Oct 7, 2019

@GrahamcOfBorg build scylladb

@erictapen
Copy link
Member

Did you consider upstreaming the patch? I guess this would be a good change for them as my os-release man page says, that ID can default to just linux.

Besides that, this LGTM but as I wrote part of it I guess it makes sense that somebody else approves these changes.

@jonringer
Copy link
Contributor

@GrahamcOfBorg build scylladb

@jonringer
Copy link
Contributor

I had trouble building this:

Build Failure
builder for '/nix/store/k2npwcd30nrcbgyy8xl67mqrn1pjwh2i-scylladb-3.0.5.drv' failed with exit code 1; last 10 log lines:
  g++ -MD -MT build/release/database.o -MF build/release/database.o.d -std=gnu++1z -g  -Wall -Werror -Wno-error=deprecated-declarations -fvisibility=hidden  -pthread -I/build/scylla-403f66e/seastar -U_FORTIFY_SOURCE  -gz -march=westmere -fconcepts -I/build/scylla-403f66e/seastar/fmt -DBOOST_TEST_DYN_LINK -Wno-ignored-attributes -Wno-overloaded-virtual -Wno-maybe-uninitialized -Wno-error=cpp -Wno-stringop-overflow -DSEASTAR_HAVE_GCC6_CONCEPTS -DSEASTAR_HAS_MEMBARRIER -DSEASTAR_HAVE_LZ4_COMPRESS_DEFAULT -DSEASTAR_HAVE_ASAN_FIBER_SUPPORT -O2 -O3 --param inline-unit-growth=300 -I/build/scylla-403f66e/seastar/build/release/gen -I/build/scylla-403f66e/seastar/build/release/c-ares -I/nix/store/zf9b2449vdif958ka250i5h0qh5kkzan-jsoncpp-1.9.1/include -DBOOST_TEST_DYN_LINK -I/nix/store/76a70m24s0rkz3id21pipqz9g669qwq4-systemd-243-dev/include -Wno-maybe-uninitialized -Wno-tautological-compare -Wno-missing-braces -Wno-misleading-indentation -Wno-overflow -Wno-noexcept-type -Wno-nonnull-compare -Wno-error=deprecated-declarations -DHAVE_LIBSYSTEMD=1 -O3 --param inline-unit-growth=300 -DXXH_PRIVATE_API -I. -I build/release/gen -I seastar -I seastar/build/release/gen  -c -o build/release/database.o database.cc
  g++: fatal error: Killed signal terminated program cc1plus
  compilation terminated.
  [60/577] CXX build/release/cql3/statements/create_table_statement.o
  FAILED: build/release/cql3/statements/create_table_statement.o
  g++ -MD -MT build/release/cql3/statements/create_table_statement.o -MF build/release/cql3/statements/create_table_statement.o.d -std=gnu++1z -g  -Wall -Werror -Wno-error=deprecated-declarations -fvisibility=hidden  -pthread -I/build/scylla-403f66e/seastar -U_FORTIFY_SOURCE  -gz -march=westmere -fconcepts -I/build/scylla-403f66e/seastar/fmt -DBOOST_TEST_DYN_LINK -Wno-ignored-attributes -Wno-overloaded-virtual -Wno-maybe-uninitialized -Wno-error=cpp -Wno-stringop-overflow -DSEASTAR_HAVE_GCC6_CONCEPTS -DSEASTAR_HAS_MEMBARRIER -DSEASTAR_HAVE_LZ4_COMPRESS_DEFAULT -DSEASTAR_HAVE_ASAN_FIBER_SUPPORT -O2 -O3 --param inline-unit-growth=300 -I/build/scylla-403f66e/seastar/build/release/gen -I/build/scylla-403f66e/seastar/build/release/c-ares -I/nix/store/zf9b2449vdif958ka250i5h0qh5kkzan-jsoncpp-1.9.1/include -DBOOST_TEST_DYN_LINK -I/nix/store/76a70m24s0rkz3id21pipqz9g669qwq4-systemd-243-dev/include -Wno-maybe-uninitialized -Wno-tautological-compare -Wno-missing-braces -Wno-misleading-indentation -Wno-overflow -Wno-noexcept-type -Wno-nonnull-compare -Wno-error=deprecated-declarations -DHAVE_LIBSYSTEMD=1 -O3 --param inline-unit-growth=300 -DXXH_PRIVATE_API -I. -I build/release/gen -I seastar -I seastar/build/release/gen  -c -o build/release/cql3/statements/create_table_statement.o cql3/statements/create_table_statement.cc
  g++: fatal error: Killed signal terminated program cc1plus
  compilation terminated.
  [77/577] CXX build/release/main.o_test_env.oions.o
  ninja: build stopped: subcommand failed.
cannot build derivation '/nix/store/ga97vinhphb6gl5dqlbsxh6f0xmsbpl4-env.drv': 1 dependencies couldn't be built
[0 built (1 failed)]
error: build of '/nix/store/ga97vinhphb6gl5dqlbsxh6f0xmsbpl4-env.drv' failed
https://github.com/NixOS/nixpkgs/pull/70576
1 package failed to build:
scylladb

No packages were successfully build, skip nix-shell

@workflow
Copy link
Contributor Author

workflow commented Oct 9, 2019

I had trouble building this:

Build Failure

@jonringer Thanks for triggering the build! This is a really heavy one, and it looks like grahamcofborg ran out of RAM. Scrolling up a bit in the logs:

virtual memory exhausted: Cannot allocate memory
[77/577] CXX build/release/tests/cql_test_env.o
FAILED: build/release/tests/cql_test_env.o
g++ -MD -MT build/release/tests/cql_test_env.o -MF build/release/tests/cql_test_env.o.d -std=gnu++1z -g  -Wall -Werror -Wno-error=deprecated-declarations -fvisibility=hidden  -pthread -I/build/scylla-403f66e/seastar -U_FORTIFY_SOURCE  -gz -march=westmere -fconcepts -I/build/scylla-403f66e/seastar/fmt -DBOOST_TEST_DYN_LINK -Wno-ignored-attributes -Wno-overloaded-virtual -Wno-maybe-uninitialized -Wno-error=cpp -Wno-stringop-overflow -DSEASTAR_HAVE_GCC6_CONCEPTS -DSEASTAR_HAS_MEMBARRIER -DSEASTAR_HAVE_LZ4_COMPRESS_DEFAULT -DSEASTAR_HAVE_ASAN_FIBER_SUPPORT -O2 -O3 --param inline-unit-growth=300 -I/build/scylla-403f66e/seastar/build/release/gen -I/build/scylla-403f66e/seastar/build/release/c-ares -I/nix/store/zf9b2449vdif958ka250i5h0qh5kkzan-jsoncpp-1.9.1/include -DBOOST_TEST_DYN_LINK -I/nix/store/76a70m24s0rkz3id21pipqz9g669qwq4-systemd-243-dev/include -Wno-maybe-uninitialized -Wno-tautological-compare -Wno-missing-braces -Wno-misleading-indentation -Wno-overflow -Wno-noexcept-type -Wno-nonnull-compare -Wno-error=deprecated-declarations -DHAVE_LIBSYSTEMD=1 -O3 --param inline-unit-growth=300 -DXXH_PRIVATE_API -I. -I build/release/gen -I seastar -I seastar/build/release/gen  -c -o build/release/tests/cql_test_env.o tests/cql_test_env.cc
virtual memory exhausted: Cannot allocate memory
[78/577] CXX build/release/database.o

How do we resolve that?

I could patch it to run on $NIX_BUILD_CORES / 2, which I've found to be much better behaved in many instances (likely due to hyperthreading), but not sure that should be in the scope of this PR.

@workflow
Copy link
Contributor Author

workflow commented Oct 9, 2019

@infinisil Can we trouble you to take a look?

@jonringer
Copy link
Contributor

I did notice that the review almost maxed out my 32Gb :(

@workflow
Copy link
Contributor Author

workflow commented Oct 9, 2019

From the manual

Note: Compiling Scylla requires, conservatively, 2 GB of memory per native thread, and up to 3 GB per native thread while linking. GCC >= 8.1.1. is required.

...so I think in this case we could reduce the -j somehow accordingly to the available memory on the system. However I would advocate doing that in a separate PR, as this PR is already an incremental improval on the build.

@workflow
Copy link
Contributor Author

workflow commented Oct 9, 2019

Did you consider upstreaming the patch? I guess this would be a good change for them as my os-release man page says, that ID can default to just linux.

Besides that, this LGTM but as I wrote part of it I guess it makes sense that somebody else approves these changes.

@erictapen I did not yet, good idea. Please, go for it if you have time :)

vcunat added a commit that referenced this pull request Oct 10, 2019
@vcunat vcunat merged commit bbaaefd into NixOS:master Oct 10, 2019
@vcunat
Copy link
Member

vcunat commented Oct 10, 2019

I noticed yesterday and used de51368. It would be possible to, say, use half of --cores, but such approaches seem relatively hacky. 2 GB seem still borderline-acceptable to me, as we have other builds eating a lot – when I started with Hydra's small nodes (t4a and t4b), I found that 8 GB was not enough for --max-jobs 4 --cores 4 in our case and 12-16 seemed OK (with /tmp/ outside RAM, at least).

@jonringer
Copy link
Contributor

probably the safest way to go is enableParallelBuilding = false;, making any assumptions about $NIX_BUILD_CORES should be left up to the user to configure.

@vcunat
Copy link
Member

vcunat commented Oct 11, 2019

Well, that's like setting cores to 1. Anyway, the main problem I see ATM is that the output is around 18 GiB, and we can't have that on the binary cache, meaning I'll disable it on Hydra as there's little point when it can't "succeed".

Perhaps almost all of the content is useless? (e.g. I see >10G in build/release/tests/) We have a hard-limit of 2G. This part is probably an overkill and messy anyway:

{
  installPhase = ''
    mkdir $out
    cp -r * $out/
  '';
}

@jonringer
Copy link
Contributor

Agreed, that's too big.

vcunat added a commit that referenced this pull request Oct 12, 2019
vcunat added a commit that referenced this pull request Oct 12, 2019
dtzWill pushed a commit to dtzWill/nixpkgs that referenced this pull request Jan 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

scylladb don't compile on nixos
4 participants