Build of 54.0 hangs in precompile_startupcache with repeated mmap ENOMEM

UNCONFIRMED
Unassigned

Status

()

Core
Build Config
UNCONFIRMED
6 months ago
6 months ago

People

(Reporter: Carl Lei, Unassigned)

Tracking

54 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 months ago
User Agent: Mozilla/5.0 (X11; Linux x86_64; rv:53.0) Gecko/20100101 Firefox/53.0
Build ID: 20170521092816

Steps to reproduce:

Building 54.0 from Arch Linux ABS with a minor change that turns off required signing.  Complete Arch Linux PKGBUILD below; I ran it with env LANG=C makepkg -cf.  Other commands and detailed configurations should be obvious in the PKGBUILD.

--- start PKGBUILD ---
# $Id: PKGBUILD 298868 2017-06-15 18:09:36Z foutrelis $
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Ionut Biru <ibiru@archlinux.org>
# Contributor: Jakub Schmidtke <sjakub@gmail.com>

pkgname=firefox
pkgver=54.0
pkgrel=1
pkgdesc="Standalone web browser from mozilla.org"
arch=(i686 x86_64)
license=(MPL GPL LGPL)
url="https://www.mozilla.org/firefox/"
depends=(gtk3 gtk2 mozilla-common libxt startup-notification mime-types dbus-glib alsa-lib ffmpeg
         nss hunspell sqlite ttf-font libpulse icu libvpx)
makedepends=(unzip zip diffutils python2 yasm mesa imake gconf inetutils xorg-server-xvfb
             autoconf2.13 cargo mercurial)
optdepends=('networkmanager: Location detection via available WiFi networks'
            'libnotify: Notification integration'
            'pulseaudio: Audio support'
            'speech-dispatcher: Text-to-Speech')
options=(!emptydirs !makeflags !strip)
_repo=https://hg.mozilla.org/mozilla-unified
source=("hg+$_repo#tag=FIREFOX_${pkgver//./_}_RELEASE"
        $pkgname.desktop firefox-symbolic.svg
        firefox-install-dir.patch no-crmf.diff fix-wifi-scanner.diff)
sha256sums=('SKIP'
            'ada313750e6fb14558b37c764409a17c1672a351a46c73b350aa1fe4ea9220ef'
            'a2474b32b9b2d7e0fb53a4c89715507ad1c194bef77713d798fa39d507def9e9'
            'd86e41d87363656ee62e12543e2f5181aadcff448e406ef3218e91865ae775cd'
            'fb85a538044c15471c12cf561d6aa74570f8de7b054a7063ef88ee1bdfc1ccbb'
            '9765bca5d63fb5525bbd0520b7ab1d27cabaed697e2fc7791400abc3fa4f13b8')

# Google API keys (see http://www.chromium.org/developers/how-tos/api-keys)
# Note: These are for Arch Linux use ONLY. For your own distribution, please
# get your own set of keys. Feel free to contact foutrelis@archlinux.org for
# more information.
_google_api_key=AIzaSyDwr302FpOSkGRpLlUpPThNTDPbXcIn_FM

# Mozilla API keys (see https://location.services.mozilla.com/api)
# Note: These are for Arch Linux use ONLY. For your own distribution, please
# get your own set of keys. Feel free to contact heftig@archlinux.org for
# more information.
_mozilla_api_key=16674381-f021-49de-8622-3021c5942aff

prepare() {
  mkdir path
  ln -s /usr/bin/python2 path/python

  cd mozilla-unified
  patch -Np1 -i ../firefox-install-dir.patch

  # https://bugzilla.mozilla.org/show_bug.cgi?id=1371991
  patch -Np1 -i ../no-crmf.diff

  # https://bugzilla.mozilla.org/show_bug.cgi?id=1314968
  patch -Np1 -i ../fix-wifi-scanner.diff

  echo -n "$_google_api_key" >google-api-key
  echo -n "$_mozilla_api_key" >mozilla-api-key

  cat >.mozconfig <<END
ac_add_options --enable-application=browser

ac_add_options --prefix=/usr
ac_add_options --enable-release
ac_add_options --enable-gold
ac_add_options --enable-pie
ac_add_options --enable-optimize="-O2"

# Branding
ac_add_options --enable-official-branding
ac_add_options --enable-update-channel=release
ac_add_options --with-distribution-id=org.archlinux
export MOZILLA_OFFICIAL=1
export MOZ_TELEMETRY_REPORTING=1
export MOZ_SOURCE_REPO=${_repo@Q}
export MOZ_ADDON_SIGNING=1
export MOZ_REQUIRE_SIGNING=0

# Keys
ac_add_options --with-google-api-keyfile=${PWD@Q}/google-api-key
ac_add_options --with-mozilla-api-keyfile=${PWD@Q}/mozilla-api-key

# System libraries
ac_add_options --with-system-nspr
ac_add_options --with-system-nss
ac_add_options --with-system-icu
ac_add_options --with-system-jpeg
ac_add_options --with-system-zlib
ac_add_options --with-system-bz2
ac_add_options --with-system-libvpx
ac_add_options --enable-system-hunspell
ac_add_options --enable-system-sqlite
ac_add_options --enable-system-ffi
ac_add_options --enable-system-pixman

# Features
ac_add_options --enable-startup-notification
ac_add_options --enable-crashreporter
ac_add_options --disable-updater

STRIP_FLAGS="--strip-debug"
END
}

build() {
  cd mozilla-unified

  # _FORTIFY_SOURCE causes configure failures
  CPPFLAGS+=" -O2"

  # Hardening
  LDFLAGS+=" -Wl,-z,now"

  export PATH="$srcdir/path:$PATH"

  # Do PGO
  #xvfb-run -a -n 95 -s "-extension GLX -screen 0 1280x1024x24" \
  #  make -f client.mk build MOZ_PGO=1
  make -f client.mk build
}

package() {
  cd mozilla-unified
  make -f client.mk DESTDIR="$pkgdir" INSTALL_SDK= install

  _vendorjs="$pkgdir/usr/lib/$pkgname/browser/defaults/preferences/vendor.js"
  install -Dm644 /dev/stdin "$_vendorjs" <<END
// Use LANG environment variable to choose locale
pref("intl.locale.matchOS", true);

// Disable default browser checking.
pref("browser.shell.checkDefaultBrowser", false);

// Don't disable our bundled extensions in the application directory
pref("extensions.autoDisableScopes", 11);
pref("extensions.shownSelectionUI", true);

// Opt all of us into e10s, instead of just 50%
pref("browser.tabs.remote.autostart", true);
END

  _distini="$pkgdir/usr/lib/$pkgname/distribution/distribution.ini"
  install -Dm644 /dev/stdin "$_distini" <<END
[Global]
id=archlinux
version=1.0
about=Mozilla Firefox for Arch Linux

[Preferences]
app.distributor=archlinux
app.distributor.channel=$pkgname
app.partner.archlinux=archlinux
END

  for i in 16 22 24 32 48 256; do
    install -Dm644 browser/branding/official/default$i.png \
      "$pkgdir/usr/share/icons/hicolor/${i}x${i}/apps/$pkgname.png"
  done
  install -Dm644 browser/branding/official/content/icon64.png \
    "$pkgdir/usr/share/icons/hicolor/64x64/apps/$pkgname.png"
  install -Dm644 browser/branding/official/mozicon128.png \
    "$pkgdir/usr/share/icons/hicolor/128x128/apps/$pkgname.png"
  install -Dm644 browser/branding/official/content/about-logo.png \
    "$pkgdir/usr/share/icons/hicolor/192x192/apps/$pkgname.png"
  install -Dm644 browser/branding/official/content/about-logo@2x.png \
    "$pkgdir/usr/share/icons/hicolor/384x384/apps/$pkgname.png"
  install -Dm644 ../firefox-symbolic.svg \
    "$pkgdir/usr/share/icons/hicolor/symbolic/apps/$pkgname-symbolic.svg"

  install -Dm644 ../$pkgname.desktop \
    "$pkgdir/usr/share/applications/$pkgname.desktop"

  # Use system-provided dictionaries
  rm -r "$pkgdir"/usr/lib/$pkgname/dictionaries
  ln -Ts /usr/share/hunspell "$pkgdir/usr/lib/$pkgname/dictionaries"
  ln -Ts /usr/share/hyphen "$pkgdir/usr/lib/$pkgname/hyphenation"

  # Install a wrapper to avoid confusion about binary path
  install -Dm755 /dev/stdin "$pkgdir/usr/bin/$pkgname" <<END
#!/bin/sh
exec /usr/lib/$pkgname/firefox "\$@"
END

  # Replace duplicate binary with wrapper
  # https://bugzilla.mozilla.org/show_bug.cgi?id=658850
  ln -srf "$pkgdir/usr/bin/$pkgname" \
    "$pkgdir/usr/lib/$pkgname/firefox-bin"
}
--- end PKGBUILD ---

CPU is Core i7-7700, 16GB RAM; compiler versions:
$ pacman -Q gcc rust
gcc 7.1.1-2
rust 1:1.17.0-1
All stock Arch Linux packages.


Actual results:

It seems to hang in xpcshell -e precompile_startupcache; strace that process says it repeatedly tries mmap which returns ENOMEM.

--- start strace output ---
$ sudo strace -p 1248
strace: Process 1248 attached
strace: [ Process PID=1248 runs in x32 mode. ]
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
strace: [ Process PID=1248 runs in 64 bit mode. ]
rt_sigreturn({mask=[]})                 = 2147483647
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 140615190787095
mmap(NULL, 17179869184, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory)
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 0
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 0
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 1259245072
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 0
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 140609560196676
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 2147418112
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 4294967294
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 140611330715331
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 2147483647
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 4294967294
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 140613101072052
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 0
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 2147418112
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 140614877485462
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 140615463199493
mmap(NULL, 17179869184, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = -1 ENOMEM (Cannot allocate memory)
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 0
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 4294967294
--- SIGVTALRM {si_signo=SIGVTALRM, si_code=SI_TKILL, si_pid=1248, si_uid=1000} ---
rt_sigreturn({mask=[]})                 = 0
--- end strace output ---

htop says the process is using 100% CPU and a lot of memory; memory usage in ps is
$ ps -o vsz -o rss -o cmd -C xpcshell 
   VSZ   RSS CMD
10118980 8441996 /home/xecycle/local/src/firefox/src/mozilla-unified/obj-x86_64

~10GB virt.

Later I tried adding a 32GB swap, the same result, except memory usage stops at 17GB.

Updated

6 months ago
Component: Untriaged → Build Config
Product: Firefox → Core
(Reporter)

Comment 1

6 months ago
The problem disappeared after rust was upgraded to 1.18.  Shall we close this now?
You need to log in before you can comment on or make changes to this bug.