Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 726128 - Chromium `ninja` command doesn't detect right amount of cores
Summary: Chromium `ninja` command doesn't detect right amount of cores
Status: RESOLVED WORKSFORME
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Gentoo Linux bug wranglers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-05-29 20:57 UTC by Guido Kroon
Modified: 2020-05-30 19:42 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Guido Kroon 2020-05-29 20:57:40 UTC
I've just bought an AMD Ryzen 3950X (16 cores, 32 threads) and my Chromium ebuilds fail with the following:

```
In file included from ../../third_party/blink/renderer/core/frame/local_frame_view.h:38,
                 from ../../third_party/blink/renderer/core/display_lock/display_lock_context.h:9,
                 from ../../third_party/blink/renderer/core/layout/layout_object.h:36,
                 from ../../third_party/blink/renderer/core/layout/layout_box_model_object.h:31,
                 from ../../third_party/blink/renderer/core/layout/layout_box.h:31,
                 from ../../third_party/blink/renderer/core/layout/layout_list_marker.h:28,
                 from ../../third_party/blink/renderer/core/layout/layout_list_marker.cc:26:
../../third_party/blink/renderer/core/frame/frame_view.h:23:52: warning: ‘clang::lto_visibility_public’ scoped attribute directive ignored [-Wattributes]
   23 | class CORE_EXPORT [[clang::lto_visibility_public]] FrameView
      |                                                    ^~~~~~~~~
In file included from /usr/include/rpc/netdb.h:42,
                 from /usr/include/netdb.h:32,
                 from ../../net/base/sys_addrinfo.h:26,
                 from ../../net/base/ip_endpoint.h:16,
                 from ../../net/url_request/url_request.h:24,
                 from ../../services/network/public/cpp/resource_request.h:19,
                 from ../../services/network/public/cpp/shared_url_loader_factory.h:15,
                 from ../../third_party/blink/public/platform/platform.h:49,
                 from ../../third_party/blink/public/platform/viewport_intersection_state.h:8,
                 from ../../third_party/blink/renderer/core/frame/frame_view.h:9,
                 from ../../third_party/blink/renderer/core/frame/local_frame_view.h:38,
                 from ../../third_party/blink/renderer/core/display_lock/display_lock_context.h:9,
                 from ../../third_party/blink/renderer/core/layout/layout_object.h:36,
                 from ../../third_party/blink/renderer/core/layout/layout_box_model_object.h:31,
                 from ../../third_party/blink/renderer/core/layout/layout_box.h:31,
                 from ../../third_party/blink/renderer/core/layout/layout_list_marker.h:28,
                 from ../../third_party/blink/renderer/core/layout/layout_list_marker.cc:26:
../../net/third_party/quiche/src/quic/core/frames/quic_inlined_frame.h: In instantiation of ‘quic::QuicInlinedFrame<DerivedT>::QuicInlinedFrame(quic::QuicFrameType) [with DerivedT = quic::QuicPaddingFrame]’:
../../net/third_party/quiche/src/quic/core/frames/quic_padding_frame.h:20:77:   required from here
../../net/third_party/quiche/src/quic/core/frames/quic_inlined_frame.h:20:28: warning: offsetof within non-standard-layout type ‘quic::QuicPaddingFrame’ is conditionally-supported [-Winvalid-offsetof]
   20 |     static_assert(offsetof(DerivedT, type) == 0,
      |                            ^
ninja: build stopped: subcommand failed.
 * ERROR: www-client/chromium-83.0.4103.61::gentoo failed (compile phase):
 *   ninja -v -j32 -l0 -C out/Release v8_context_snapshot_generator failed
 * 
 * Call stack:
 *     ebuild.sh, line  125:  Called src_compile
 *   environment, line 4260:  Called eninja '-C' 'out/Release' 'v8_context_snapshot_generator'
 *   environment, line 1943:  Called die
 * The specific snippet of code:
 *       "$@" || die "${nonfatal_args[@]}" "${*} failed"
 * 
 * If you need support, post the output of `emerge --info '=www-client/chromium-83.0.4103.61::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=www-client/chromium-83.0.4103.61::gentoo'`.
 * 
 * MemTotal:       32823584 kB
 * SwapTotal:       5580008 kB
 * 
 * The complete build log is located at '/var/tmp/portage/www-client/chromium-83.0.4103.61/temp/build.log.gz'.
 * The ebuild environment file is located at '/var/tmp/portage/www-client/chromium-83.0.4103.61/temp/environment'.
 * Working directory: '/var/tmp/portage/www-client/chromium-83.0.4103.61/work/chromium-83.0.4103.61'
 * S: '/var/tmp/portage/www-client/chromium-83.0.4103.61/work/chromium-83.0.4103.61'

 * Messages for package www-client/chromium-83.0.4103.61:

 * ERROR: www-client/chromium-83.0.4103.61::gentoo failed (compile phase):
 *   ninja -v -j32 -l0 -C out/Release v8_context_snapshot_generator failed
 * 
 * Call stack:
 *     ebuild.sh, line  125:  Called src_compile
 *   environment, line 4260:  Called eninja '-C' 'out/Release' 'v8_context_snapshot_generator'
 *   environment, line 1943:  Called die
 * The specific snippet of code:
 *       "$@" || die "${nonfatal_args[@]}" "${*} failed"
 * 
 * If you need support, post the output of `emerge --info '=www-client/chromium-83.0.4103.61::gentoo'`,
 * the complete build log and the output of `emerge -pqv '=www-client/chromium-83.0.4103.61::gentoo'`.
 * The complete build log is located at '/var/tmp/portage/www-client/chromium-83.0.4103.61/temp/build.log.gz'.
 * The ebuild environment file is located at '/var/tmp/portage/www-client/chromium-83.0.4103.61/temp/environment'.
 * Working directory: '/var/tmp/portage/www-client/chromium-83.0.4103.61/work/chromium-83.0.4103.61'
 * S: '/var/tmp/portage/www-client/chromium-83.0.4103.61/work/chromium-83.0.4103.61'
 * 
 * The following package has failed to build, install, or execute postinst:
 * 
 *  (www-client/chromium-83.0.4103.61:0/0::gentoo, ebuild scheduled for merge), Log file:
 *   '/var/tmp/portage/www-client/chromium-83.0.4103.61/temp/build.log.gz'
 * 

```

Notice the `ninja -v -j32 -l0 -C out/Release v8_context_snapshot_generator failed`. I suspect `ninja` is being executed with an improper amount of jobs, which should should be equal to the amount of cores - not threads. Likewise, my make.conf has `EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} --jobs=16 --load-average=16"`, otherwise my systems freezes when replacing jobs and load average with '32'.



Reproducible: Always

Steps to Reproduce:
1. Buy a 3950X
2. Compile latest Chromium
3. Cry when it fails to build
Actual Results:  
Please see the description. The complete ouput is too much, but the last few lines should be enough to get the idea, yes?

Expected Results:  
I expected Chromium to build.

I'm on Pentoo (Gentoo + Pentoo overlay with pentesting tools), but I don't think that's especially relevant as I'm building Chromium from the Gentoo tree.
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-05-29 21:04:26 UTC
Note that MAKEOPTS is how you specify the number of concurrent make jobs to be running at a given time, while `emerge --jobs` is the number of concurrent emerges to run at a time.

So, suppose you ran `emerge --jobs=3 firefox chromium libreoffice`, Firefox and Chromium would (try to) compile in parallel (provided no deps were an issue), then LibreOffice would compile once the first one finishes.

MAKEOPTS in make.conf defaults (with Portage) to the number of cores on the system, so that's your problem. Try setting this to 16 with MAKEOPTS="-j16".

I would recommend you drop your default emerge jobs down because if you had 16 emerges all running 16 jobs, you might quickly run out of RAM.

Please let me know if that helps you.
Comment 2 cyrillic 2020-05-30 14:46:17 UTC
(In reply to Guido Kroon from comment #0)

> Please see the description. The complete ouput is too much, but the last few
> lines should be enough to get the idea, yes?

The part that you posted does not include the actual error, only warnings, but if I had to guess, you are not running out of memory.

My setup is similar to yours: 24 core Threadripper, 64G RAM, and I normally do MAKEOPTS="-j48". Chromium-84 compiles fine for me with clang-10, and so you should not be having any trouble with -j32.
Comment 3 Guido Kroon 2020-05-30 18:21:00 UTC
(In reply to Sam James (sec padawan) from comment #1)
> MAKEOPTS in make.conf defaults (with Portage) to the number of cores on the
> system, so that's your problem. Try setting this to 16 with MAKEOPTS="-j16".

Thanks for your reply. If I use -j16, I'm throwing away half of my threads. I don't think that would be a good solution, right?
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-05-30 19:08:17 UTC
(In reply to Guido Kroon from comment #3)
> (In reply to Sam James (sec padawan) from comment #1)
> > MAKEOPTS in make.conf defaults (with Portage) to the number of cores on the
> > system, so that's your problem. Try setting this to 16 with MAKEOPTS="-j16".
> 
> Thanks for your reply. If I use -j16, I'm throwing away half of my threads.
> I don't think that would be a good solution, right?

No problem. You can use any -jN value you like, I was just suggesting 16 because it's usually sensible(ish).

For bigger packages, a good rule is N/2 where N is your RAM, because jobs may take up to 2GB of RAM each.

Trying to find the balance between Portage's --jobs and MAKEOPTS' --jobs/-j is difficult, but --load-average / -l may help you with that too.
Comment 5 Guido Kroon 2020-05-30 19:16:36 UTC
(In reply to Sam James (sec padawan) from comment #4)
> For bigger packages, a good rule is N/2 where N is your RAM, because jobs
> may take up to 2GB of RAM each.
Is there a way to set this for specific packages? For example, -j32 for all packages, but -j16 as an override just for Chromium.
Comment 6 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2020-05-30 19:17:40 UTC
(In reply to Guido Kroon from comment #5)
> (In reply to Sam James (sec padawan) from comment #4)
> > For bigger packages, a good rule is N/2 where N is your RAM, because jobs
> > may take up to 2GB of RAM each.
> Is there a way to set this for specific packages? For example, -j32 for all
> packages, but -j16 as an override just for Chromium.

Yep! https://wiki.gentoo.org/wiki//etc/portage/package.env
Comment 7 Guido Kroon 2020-05-30 19:34:24 UTC
(In reply to Sam James (sec padawan) from comment #6)
> (In reply to Guido Kroon from comment #5)
> > (In reply to Sam James (sec padawan) from comment #4)
> > > For bigger packages, a good rule is N/2 where N is your RAM, because jobs
> > > may take up to 2GB of RAM each.
> > Is there a way to set this for specific packages? For example, -j32 for all
> > packages, but -j16 as an override just for Chromium.
> 
> Yep! https://wiki.gentoo.org/wiki//etc/portage/package.env

Thanks, it seems to works like a charm!
Comment 8 Guido Kroon 2020-05-30 19:42:36 UTC
(In reply to cyrillic from comment #2)
> My setup is similar to yours: 24 core Threadripper, 64G RAM, and I normally
> do MAKEOPTS="-j48". Chromium-84 compiles fine for me with clang-10, and so
> you should not be having any trouble with -j32.

Thanks for your reply. It my system seems kind of like your system's little brother. I think -j32 doesn't work for me for Chromium because I've "only" got 32G RAM. I think I've managed to work around this by using Sam James' /etc/portage/package.env suggestion.