Yarn: Segmentation fault.

Created on 4 Nov 2016  ยท  23Comments  ยท  Source: yarnpkg/yarn

Do you want to request a feature or report a bug?
Bug

What is the current behavior?
Segfault

If the current behavior is a bug, please provide the steps to reproduce.
Not sure, the behavior is intermittent. It has to do with pushing tags to a CI server (could be a synchronization issue)

What is the expected behavior?
Either yarn install should work or it should show an informative error message of one of its files are corrupted.

Please mention your node.js, yarn and operating system version.
yarn v0.16.1

yarn install v0.16.1 [1/5] Resolving packages... [2/5] Fetching packages... warning [email protected]: The platform "linux" is incompatible with this module. info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation. [3/5] Linking dependencies... /bin/bash: line 47: 8 Segmentation fault (core dumped) yarn install

Most helpful comment

Seems to be a combination of:

  • empty node_modules
  • empty .yarn-cache
  • existing yarn.lock

All 23 comments

This is the DockerFile for the environment:

FROM node:latest

MAINTAINER Sam Mousa <[email protected]>

#RUN apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 && \
#echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && \
#apt-get update && apt-get -y install --no-install-recommends yarn && rm -rf /var/lib/apt/lists/*
#RUN yarn global add angular-cli && yarn cache clean
RUN npm config set loglevel warn && npm install --no-optional --only=prod -g yarn angular-cli && \
 npm cache clean

Seems to be a combination of:

  • empty node_modules
  • empty .yarn-cache
  • existing yarn.lock

Hmm this is tricky, I don't know what could possibly be causing a segfault. Could you please try to get a backtrace? Removing the yarn install from your Dockerfile then executing /bin/bash in the container should give you a shell and allow you to debug it via GDB. Run gdb yarn to open GDB and attach it to Yarn, then run run install in GDB to execute "yarn install". Once it segfaults, run bt to get a backtrace. A lot of the trace will be empty if you don't have debug versions of packages installed (due to the lack of debug symbols) but the output may still be useful for determining exactly _which_ library is segfaulting.

By the way, I can't repro with the ubuntu:16.04 Docker image. For Yarn, we have end-to-end tests that spin up a Ubuntu Docker box, does apt-get install yarn, then runs yarn install. See https://github.com/yarnpkg/yarn/tree/master/end_to_end_tests

I did that; didn't get a backtrace at all.
This is my yarn.lock:
yarn.txt

This is my package.json
package.txt

I can reproduce it in a fresh directory with just these 2 files.
Interestingly when node_modules exist it is no issue; currently I use this in my ci: - yarn install --cache-folder /yarn || yarn install --cache-folder /yarn as a workaround.
The first time it installs the modules, the 2nd time it actually succeed past the linking dependencies step.

Hmm, I'm unable to repro even with the same node:latest Docker image:

C:\Users\Daniel> docker run -it node:latest bash
root@241d20dc168e:/# apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.3yzrtzFqem --no-auto-check-trustdb --trust-model always --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-security-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg --keyserver pgp.mit.edu --recv D101F7899D41F3C3
gpg: requesting key 9D41F3C3 from hkp server pgp.mit.edu
gpg: key 86E50310: public key "Yarn Packaging <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
root@241d20dc168e:/# echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
root@241d20dc168e:/# apt-get update &&  apt-get -y install --no-install-recommends yarn
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:2 http://dl.yarnpkg.com stable InRelease [2464 B]
Get:3 http://security.debian.org jessie/updates/main amd64 Packages [402 kB]
Ign http://deb.debian.org jessie InRelease
Get:4 http://dl.yarnpkg.com stable/main amd64 Packages [880 B]
Get:5 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:6 http://deb.debian.org jessie Release.gpg [2373 B]
Get:7 http://deb.debian.org jessie Release [148 kB]
Get:8 http://deb.debian.org jessie-updates/main amd64 Packages [17.6 kB]
Get:9 http://deb.debian.org jessie/main amd64 Packages [9064 kB]
Fetched 9846 kB in 6s (1534 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Recommended packages:
  nodejs
The following NEW packages will be installed:
  yarn
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 1472 kB of archives.
After this operation, 20.4 MB of additional disk space will be used.
Get:1 http://dl.yarnpkg.com/debian/ stable/main yarn all 0.16.1-1 [1472 kB]
Fetched 1472 kB in 1s (794 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package yarn.
(Reading database ... 21206 files and directories currently installed.)
Preparing to unpack .../archives/yarn_0.16.1-1_all.deb ...
Unpacking yarn (0.16.1-1) ...
Setting up yarn (0.16.1-1) ...
root@241d20dc168e:/# yarn --version
0.16.1
root@241d20dc168e:/# yarn global add angular-cli
yarn global v0.16.1
[1/4] Resolving packages...
warning angular-cli > ember-cli > findup-sync > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > ember-cli > npm > node-gyp > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > protractor > jasmine > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > angular2-template-loader > codecov > execSync > temp > rimraf > [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
warning angular-cli > remap-istanbul > istanbul > fileset > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > protractor > request > [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
warning angular-cli > ember-cli > broccoli-babel-transpiler > babel-core > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > ember-cli > core-object > [email protected]: This package is discontinued. Use lodash@^4.0.0.
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed [email protected] with binaries:
      - ng
Done in 57.37s.
root@241d20dc168e:/#

I also can't repro with your Dockerfile:

C:\temp\Dockertest> docker build .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM node:latest
 ---> 04c0ca2a8dad
Step 2 : MAINTAINER Sam Mousa <[email protected]>
 ---> Running in c984c39a732f
 ---> ccb1a6c95445
Removing intermediate container c984c39a732f
Step 3 : RUN apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 && echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && apt-get update && apt-get -y install --no-install-recommends yarn && rm -rf /var/lib/apt/lists/*
 ---> Running in c5cb35af7ce7
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.mIpPo2obDn --no-auto-check-trustdb --trust-model always --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-security-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg --keyserver pgp.mit.edu --recv D101F7899D41F3C3
gpg: requesting key 9D41F3C3 from hkp server pgp.mit.edu
gpg: key 86E50310: public key "Yarn Packaging <[email protected]>" imported
gpg: Total number processed: 1
gpg:               imported: 1  (RSA: 1)
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:2 http://dl.yarnpkg.com stable InRelease [2464 B]
Get:3 http://security.debian.org jessie/updates/main amd64 Packages [402 kB]
Ign http://deb.debian.org jessie InRelease
Get:4 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:5 http://deb.debian.org jessie Release.gpg [2373 B]
Get:6 http://dl.yarnpkg.com stable/main amd64 Packages [880 B]
Get:7 http://deb.debian.org jessie Release [148 kB]
Get:8 http://deb.debian.org jessie-updates/main amd64 Packages [17.6 kB]
Get:9 http://deb.debian.org jessie/main amd64 Packages [9064 kB]
Fetched 9846 kB in 7s (1295 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Recommended packages:
  nodejs
The following NEW packages will be installed:
  yarn
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 1472 kB of archives.
After this operation, 20.4 MB of additional disk space will be used.
Get:1 http://dl.yarnpkg.com/debian/ stable/main yarn all 0.16.1-1 [1472 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 1472 kB in 0s (3479 kB/s)
Selecting previously unselected package yarn.
(Reading database ... 21206 files and directories currently installed.)
Preparing to unpack .../archives/yarn_0.16.1-1_all.deb ...
Unpacking yarn (0.16.1-1) ...
Setting up yarn (0.16.1-1) ...
 ---> 19428394ef69
Removing intermediate container c5cb35af7ce7
Step 4 : RUN yarn global add angular-cli && yarn cache clean
 ---> Running in a756dba8f2f1
yarn global v0.16.1
[1/4] Resolving packages...
warning angular-cli > ember-cli > findup-sync > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > protractor > jasmine > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > angular2-template-loader > codecov > execSync > temp > rimraf > [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
warning angular-cli > ember-cli > npm > node-gyp > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > protractor > request > [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
warning angular-cli > remap-istanbul > istanbul > fileset > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > ember-cli > core-object > [email protected]: This package is discontinued. Use lodash@^4.0.0.
warning angular-cli > ember-cli > broccoli-babel-transpiler > babel-core > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed [email protected] with binaries:
      - ng
Done in 68.70s.
yarn cache v0.16.1
success Cleared cache.
Done in 3.24s.
 ---> 85807e76cc76
Removing intermediate container a756dba8f2f1
Successfully built 85807e76cc76
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.

I will try to reproduce it on another system to see if I can narrow it down.

On Nov 5, 2016 07:06, "Daniel Lo Nigro" [email protected] wrote:

Hmm, I'm unable to repro even with the same Docker image:

C:\Users\Daniel> docker run -it node:latest bash
root@241d20dc168e:/# apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.3yzrtzFqem --no-auto-check-trustdb --trust-model always --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-security-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg --keyserver pgp.mit.edu --recv D101F7899D41F3C3
gpg: requesting key 9D41F3C3 from hkp server pgp.mit.edu
gpg: key 86E50310: public key "Yarn Packaging [email protected]" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
root@241d20dc168e:/# echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list
root@241d20dc168e:/# apt-get update && apt-get -y install --no-install-recommends yarn
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:2 http://dl.yarnpkg.com stable InRelease [2464 B]
Get:3 http://security.debian.org jessie/updates/main amd64 Packages [402 kB]
Ign http://deb.debian.org jessie InRelease
Get:4 http://dl.yarnpkg.com stable/main amd64 Packages [880 B]
Get:5 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:6 http://deb.debian.org jessie Release.gpg [2373 B]
Get:7 http://deb.debian.org jessie Release [148 kB]
Get:8 http://deb.debian.org jessie-updates/main amd64 Packages [17.6 kB]
Get:9 http://deb.debian.org jessie/main amd64 Packages [9064 kB]
Fetched 9846 kB in 6s (1534 kB/s)
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Recommended packages:
nodejs
The following NEW packages will be installed:
yarn
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 1472 kB of archives.
After this operation, 20.4 MB of additional disk space will be used.
Get:1 http://dl.yarnpkg.com/debian/ stable/main yarn all 0.16.1-1 [1472 kB]
Fetched 1472 kB in 1s (794 kB/s)
debconf: delaying package configuration, since apt-utils is not installed
Selecting previously unselected package yarn.
(Reading database ... 21206 files and directories currently installed.)
Preparing to unpack .../archives/yarn_0.16.1-1_all.deb ...
Unpacking yarn (0.16.1-1) ...
Setting up yarn (0.16.1-1) ...
root@241d20dc168e:/# yarn --version
0.16.1
root@241d20dc168e:/# yarn global add angular-cli
yarn global v0.16.1
[1/4] Resolving packages...
warning angular-cli > ember-cli > findup-sync > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > ember-cli > npm > node-gyp > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > protractor > jasmine > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > angular2-template-loader > codecov > execSync > temp > rimraf > [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
warning angular-cli > remap-istanbul > istanbul > fileset > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > protractor > request > [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
warning angular-cli > ember-cli > broccoli-babel-transpiler > babel-core > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > ember-cli > core-object > [email protected]: This package is discontinued. Use lodash@^4.0.0.
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed [email protected] with binaries:
- ng
Done in 57.37s.
root@241d20dc168e:/#

I also can't repro with your Dockerfile:

C:\temp\Dockertest> docker build .
Sending build context to Docker daemon 2.048 kB
Step 1 : FROM node:latest
---> 04c0ca2a8dad
Step 2 : MAINTAINER Sam Mousa [email protected]
---> Running in c984c39a732f
---> ccb1a6c95445
Removing intermediate container c984c39a732f
Step 3 : RUN apt-key adv --keyserver pgp.mit.edu --recv D101F7899D41F3C3 && echo "deb http://dl.yarnpkg.com/debian/ stable main" > /etc/apt/sources.list.d/yarn.list && apt-get update && apt-get -y install --no-install-recommends yarn && rm -rf /var/lib/apt/lists/*
---> Running in c5cb35af7ce7
Executing: gpg --ignore-time-conflict --no-options --no-default-keyring --homedir /tmp/tmp.mIpPo2obDn --no-auto-check-trustdb --trust-model always --primary-keyring /etc/apt/trusted.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-security-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-jessie-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-squeeze-stable.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-automatic.gpg --keyring /etc/apt/trusted.gpg.d/debian-archive-wheezy-stable.gpg --keyserver pgp.mit.edu --recv D101F7899D41F3C3
gpg: requesting key 9D41F3C3 from hkp server pgp.mit.edu
gpg: key 86E50310: public key "Yarn Packaging [email protected]" imported
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
Get:1 http://security.debian.org jessie/updates InRelease [63.1 kB]
Get:2 http://dl.yarnpkg.com stable InRelease [2464 B]
Get:3 http://security.debian.org jessie/updates/main amd64 Packages [402 kB]
Ign http://deb.debian.org jessie InRelease
Get:4 http://deb.debian.org jessie-updates InRelease [145 kB]
Get:5 http://deb.debian.org jessie Release.gpg [2373 B]
Get:6 http://dl.yarnpkg.com stable/main amd64 Packages [880 B]
Get:7 http://deb.debian.org jessie Release [148 kB]
Get:8 http://deb.debian.org jessie-updates/main amd64 Packages [17.6 kB]
Get:9 http://deb.debian.org jessie/main amd64 Packages [9064 kB]
Fetched 9846 kB in 7s (1295 kB/s)
Reading package lists...
Reading package lists...
Building dependency tree...
Reading state information...
Recommended packages:
nodejs
The following NEW packages will be installed:
yarn
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 1472 kB of archives.
After this operation, 20.4 MB of additional disk space will be used.
Get:1 http://dl.yarnpkg.com/debian/ stable/main yarn all 0.16.1-1 [1472 kB]
debconf: delaying package configuration, since apt-utils is not installed
Fetched 1472 kB in 0s (3479 kB/s)
Selecting previously unselected package yarn.
(Reading database ... 21206 files and directories currently installed.)
Preparing to unpack .../archives/yarn_0.16.1-1_all.deb ...
Unpacking yarn (0.16.1-1) ...
Setting up yarn (0.16.1-1) ...
---> 19428394ef69
Removing intermediate container c5cb35af7ce7
Step 4 : RUN yarn global add angular-cli && yarn cache clean
---> Running in a756dba8f2f1
yarn global v0.16.1
[1/4] Resolving packages...
warning angular-cli > ember-cli > findup-sync > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > protractor > jasmine > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > angular2-template-loader > codecov > execSync > temp > rimraf > [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
warning angular-cli > ember-cli > npm > node-gyp > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > protractor > request > [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
warning angular-cli > remap-istanbul > istanbul > fileset > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > ember-cli > core-object > [email protected]: This package is discontinued. Use lodash@^4.0.0.
warning angular-cli > ember-cli > broccoli-babel-transpiler > babel-core > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed [email protected] with binaries:
- ng
Done in 68.70s.
yarn cache v0.16.1
success Cleared cache.
Done in 3.24s.
---> 85807e76cc76
Removing intermediate container a756dba8f2f1
Successfully built 85807e76cc76
SECURITY WARNING: You are building a Docker image from Windows against a non-Windows Docker host. All files and directories added to build context will have '-rwxr-xr-x' permissions. It is recommended to double check and reset permissions for sensitive files and directories.

โ€”
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/yarnpkg/yarn/issues/1682#issuecomment-258593659, or mute
the thread
https://github.com/notifications/unsubscribe-auth/AAhYze8_Alp9oBRyOo_weG37VEE1GNn5ks5q7BzhgaJpZM4Kpbr8
.

Hi,
I have the same issue on Windows machine:

PS C:\Code\template> yarn
yarn install v0.16.1
info No lockfile found.
[1/4] Resolving packages...
warning babel-core > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[2/4] Fetching packages...
warning [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
[4/4] Building fresh packages...
[1/1] โก€ fsevents: Failed to execute 'node-gyp.cmd configure --fallback-to-build --module=C:\Code\react-es6-webpack-minimal-s
[-/1] โก€ waiting...
[-/1] โก€ waiting...
[-/1] โก€ waiting...
error Error running install script for optional dependency: "C:\Code\rtemplatenode_modules\fseve
nts: Command failed.\nExit code: 1\nCommand: C:\WINDOWSsystem32\cmd.exe\nArguments: /d /s /c node-pre-gyp install --fallback-to-bu
ild\nDirectory: C:\Code\templatenode_modules\fsevents\nOutput:\nnode-pre-gyp info it worked if
it ends with ok\nnode-pre-gyp info using [email protected]\nnode-pre-gyp info using [email protected] | win32 | x64\nnode-pre-gyp info chec....

@jquintozamora That looks like a separate issue :)

Okay I prepared a Dockerfile that you can build to reproduce the segfault:

FROM node:latest

MAINTAINER Sam Mousa <[email protected]>

RUN npm config set loglevel warn && npm install --no-optional --only=prod -g yarn angular-cli && \
 npm cache clean

# Use base64 encoded package.json (less work then escaping).
#{
#  "name": "data-exploration-tool",
#  "description": "Data exploration tool for WHO",
#  "version": "0.1.0",
#  "angular-cli": {},
#  "scripts": {
#    "start": "node --max-old-space-size=4000 ng serve",
#    "lint": "tslint \"src/**/*.ts\"",
#    "test": "ng test",
#    "pree2e": "webdriver-manager update",
#    "e2e": "protractor"
#  },
#  "private": true,
#  "dependencies": {
#    "@angular/common": "^2",
#    "@angular/compiler": "^2",
#    "@angular/core": "^2",
#    "@angular/forms": "^2",
#    "@angular/http": "^2",
#    "@angular/material": "^2.0.0-alpha.9-3",
#    "@angular/platform-browser": "^2",
#    "@angular/platform-browser-dynamic": "^2",
#    "@angular/platform-server": "^2",
#    "@angular/router": "^3.0",
#    "angular2-highcharts": "^0.4",
#    "bootstrap": "^3.3.6",
#    "core-js": "^2.4.1",
#    "material-design-icons": "^3.0.1",
#    "pivottable": "^2.1.0",
#    "proj4": "^2.3.15",
#    "rxjs": "5.0.0-beta.12",
#    "zone.js": "^0.6.23"
#  },
#  "devDependencies": {
#    "@types/jasmine": "^2.2.30",
#    "@types/jquery": "^2.0.33",
#    "@types/node": "^6.0.45",
#    "@types/proj4": "^2.3.2",
#    "codelyzer": "^1.0.0-beta.1",
#    "angular-cli": "1.0.0-beta.19-3",
#    "node-sass": "^3.11.1",
#    "jasmine-core": "2.4.1",
#    "jasmine-spec-reporter": "2.5.0",
#    "karma": "1.2.0",
#    "karma-chrome-launcher": "^2.0.0",
#    "karma-cli": "^1.0.1",
#    "karma-jasmine": "^1.0.2",
#    "protractor": "4.0.9",
#    "ts-node": "1.2.1",
#    "tslint": "3.13.0",
#    "typescript": "^2.0.6"
#  }
#}
#
RUN mkdir -p /tmp/modules && mkdir -p /tmp/cache && echo ew0KICAibmFtZSI6ICJkYXRhLWV4cGxvcmF0aW9uLXRvb2wiLA0KICAiZGVzY3JpcHRpb24iOiAiRGF0YSBleHBsb3JhdGlvbiB0b29sIGZvciBXSE8iLA0KICAidmVyc2lvbiI6ICIwLjEuMCIsDQogICJhbmd1bGFyLWNsaSI6IHt9LA0KICAic2NyaXB0cyI6IHsNCiAgICAic3RhcnQiOiAibm9kZSAtLW1heC1vbGQtc3BhY2Utc2l6ZT00MDAwIG5nIHNlcnZlIiwNCiAgICAibGludCI6ICJ0c2xpbnQgXCJzcmMvKiovKi50c1wiIiwNCiAgICAidGVzdCI6ICJuZyB0ZXN0IiwNCiAgICAicHJlZTJlIjogIndlYmRyaXZlci1tYW5hZ2VyIHVwZGF0ZSIsDQogICAgImUyZSI6ICJwcm90cmFjdG9yIg0KICB9LA0KICAicHJpdmF0ZSI6IHRydWUsDQogICJkZXBlbmRlbmNpZXMiOiB7DQogICAgIkBhbmd1bGFyL2NvbW1vbiI6ICJeMiIsDQogICAgIkBhbmd1bGFyL2NvbXBpbGVyIjogIl4yIiwNCiAgICAiQGFuZ3VsYXIvY29yZSI6ICJeMiIsDQogICAgIkBhbmd1bGFyL2Zvcm1zIjogIl4yIiwNCiAgICAiQGFuZ3VsYXIvaHR0cCI6ICJeMiIsDQogICAgIkBhbmd1bGFyL21hdGVyaWFsIjogIl4yLjAuMC1hbHBoYS45LTMiLA0KICAgICJAYW5ndWxhci9wbGF0Zm9ybS1icm93c2VyIjogIl4yIiwNCiAgICAiQGFuZ3VsYXIvcGxhdGZvcm0tYnJvd3Nlci1keW5hbWljIjogIl4yIiwNCiAgICAiQGFuZ3VsYXIvcGxhdGZvcm0tc2VydmVyIjogIl4yIiwNCiAgICAiQGFuZ3VsYXIvcm91dGVyIjogIl4zLjAiLA0KICAgICJhbmd1bGFyMi1oaWdoY2hhcnRzIjogIl4wLjQiLA0KICAgICJib290c3RyYXAiOiAiXjMuMy42IiwNCiAgICAiY29yZS1qcyI6ICJeMi40LjEiLA0KICAgICJtYXRlcmlhbC1kZXNpZ24taWNvbnMiOiAiXjMuMC4xIiwNCiAgICAicGl2b3R0YWJsZSI6ICJeMi4xLjAiLA0KICAgICJwcm9qNCI6ICJeMi4zLjE1IiwNCiAgICAicnhqcyI6ICI1LjAuMC1iZXRhLjEyIiwNCiAgICAiem9uZS5qcyI6ICJeMC42LjIzIg0KICB9LA0KICAiZGV2RGVwZW5kZW5jaWVzIjogew0KICAgICJAdHlwZXMvamFzbWluZSI6ICJeMi4yLjMwIiwNCiAgICAiQHR5cGVzL2pxdWVyeSI6ICJeMi4wLjMzIiwNCiAgICAiQHR5cGVzL25vZGUiOiAiXjYuMC40NSIsDQogICAgIkB0eXBlcy9wcm9qNCI6ICJeMi4zLjIiLA0KICAgICJjb2RlbHl6ZXIiOiAiXjEuMC4wLWJldGEuMSIsDQogICAgImFuZ3VsYXItY2xpIjogIjEuMC4wLWJldGEuMTktMyIsDQogICAgIm5vZGUtc2FzcyI6ICJeMy4xMS4xIiwNCiAgICAiamFzbWluZS1jb3JlIjogIjIuNC4xIiwNCiAgICAiamFzbWluZS1zcGVjLXJlcG9ydGVyIjogIjIuNS4wIiwNCiAgICAia2FybWEiOiAiMS4yLjAiLA0KICAgICJrYXJtYS1jaHJvbWUtbGF1bmNoZXIiOiAiXjIuMC4wIiwNCiAgICAia2FybWEtY2xpIjogIl4xLjAuMSIsDQogICAgImthcm1hLWphc21pbmUiOiAiXjEuMC4yIiwNCiAgICAicHJvdHJhY3RvciI6ICI0LjAuOSIsDQogICAgInRzLW5vZGUiOiAiMS4yLjEiLA0KICAgICJ0c2xpbnQiOiAiMy4xMy4wIiwNCiAgICAidHlwZXNjcmlwdCI6ICJeMi4wLjYiDQogIH0NCn0= | base64 --decode > /tmp/package.json
RUN cd /tmp && yarn install --cache-folder cache --modules-folder modules

Building this file (with empty context) will give you a segmentation fault. Note that the package.json is base64 encoded since that is less work then properly escaping the json file. For easy reference it has been added in comments as well.

Step 5 : RUN cd /tmp && yarn install --cache-folder cache --modules-folder modules
 ---> Running in f2d0a6b9a06e
yarn install v0.16.1
info No lockfile found.
[1/4] Resolving packages...
warning angular-cli > protractor > jasmine > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > ember-cli > findup-sync > glob > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > protractor > request > [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
warning angular-cli > ember-cli > npm > node-gyp > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > angular2-template-loader > codecov > execSync > temp > rimraf > [email protected]: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
warning angular-cli > ember-cli > core-object > [email protected]: This package is discontinued. Use lodash@^4.0.0.
warning angular-cli > ember-cli > broccoli-babel-transpiler > babel-core > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning angular-cli > remap-istanbul > istanbul > fileset > [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
Segmentation fault (core dumped)
The command '/bin/sh -c cd /tmp && yarn install --cache-folder cache --modules-folder modules' returned a non-zero code: 139

Hi, I have the same problem with empty node_modules and empty cache:

segfault at 99 ip 00007fb821a42304 sp 00007ffeb1c8a568 error 4 in libc-2.24.so[7fb8219c7000+195000]

But I noticed something else:
the segmentation fault seems to happen only if the cache directory is completely removed (because I tried once with the cache directory empty, and the roadrunner.js file still in it, and it didn't segfault!)

Here is a stacktrace:

(gdb) run /usr/bin/yarn
Starting program: /usr/bin/node /usr/bin/yarn
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
[New Thread 0x7ffff7ff7700 (LWP 8198)]
[New Thread 0x7ffff3778700 (LWP 8199)]
[New Thread 0x7ffff2f77700 (LWP 8200)]
[New Thread 0x7ffff2776700 (LWP 8201)]
[New Thread 0x7ffff1f75700 (LWP 8202)]
yarn install v0.17.3
[New Thread 0x7ffff1774700 (LWP 8203)]
[New Thread 0x7ffff0f73700 (LWP 8204)]
[New Thread 0x7fffe3fff700 (LWP 8205)]
[New Thread 0x7fffe37fe700 (LWP 8206)]
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning Incorrect peer dependency "[email protected]".
warning Incorrect peer dependency "[email protected]".
warning Unmet peer dependency "@angular/[email protected]".
warning Incorrect peer dependency "[email protected]".
warning Incorrect peer dependency "[email protected]".
warning Incorrect peer dependency "@angular/compiler@~2.1.1".
warning Incorrect peer dependency "@angular/core@~2.1.1".
โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘โ–‘ 123771/151258
Thread 1 "node" received signal SIGSEGV, Segmentation fault.
0x0000000000b6d57a in v8::internal::LargePage::ClearOutOfLiveRangeSlots(unsigned char*) ()
(gdb) bt
#0  0x0000000000b6d57a in v8::internal::LargePage::ClearOutOfLiveRangeSlots(unsigned char*) ()
#1  0x0000000000b6e92f in v8::internal::LargeObjectSpace::FreeUnmarkedObjects() ()
#2  0x0000000000b41ff2 in v8::internal::MarkCompactCollector::SweepSpaces() ()
#3  0x0000000000b46eb2 in v8::internal::MarkCompactCollector::CollectGarbage() ()
#4  0x0000000000b1d0ca in v8::internal::Heap::MarkCompact() ()
#5  0x0000000000b1fbd6 in v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) ()
#6  0x0000000000b20273 in v8::internal::Heap::CollectGarbage(v8::internal::GarbageCollector, char const*, char const*, v8::GCCallbackFlags) ()
#7  0x0000000000b21ed5 in v8::internal::Heap::HandleGCRequest() ()
#8  0x0000000000ad482c in v8::internal::StackGuard::HandleInterrupts() ()
#9  0x0000000000d50b89 in v8::internal::Runtime_StackGuard(int, v8::internal::Object**, v8::internal::Isolate*) ()
#10 0x00001b0816d063a7 in ?? ()
#11 0x00001b0816d062e1 in ?? ()
#12 0x00007fffffff9c10 in ?? ()
#13 0x0000000300000000 in ?? ()
#14 0x00007fffffff9ca0 in ?? ()
#15 0x00001b081789e5a9 in ?? ()
#16 0x00003fea62882ba1 in ?? ()
#17 0x0000000a00000000 in ?? ()
#18 0x00002d3a37d3e821 in ?? ()
#19 0x000022bbd9c04311 in ?? ()
#20 0x00002d3a37d3e729 in ?? ()
#21 0x0000000000000000 in ?? ()
(gdb) 

@Daniel15 I think you can try to reproduce it if you run yarn in the frontend folder of this project.
Remove ~/.cache/yarn/ first! I am using yarn 0.17.3 with node 7.1.0 on Linux

@victornoel, can you try on the just released 0.17.4? There was a fix merged to ensure the cache directory always exists.

@wyze that's what I was doing when you asked, I thought it would be related ;)

It worked once, but then, it segfaulted again, and this time I didn't even remove the cache, only the node_modules directory!
The backtrace is the same as before... not very helpful! if you know how to get better information as to when it happens with yarn, I would gladly help!

Thanks for the backtrace, @victornoel! I feel like this must be either a Node.js bug or a V8 bug... I wonder if we could make a standalone repro and file it as a Node.js bug.

@Daniel15 this kind of bug, it's hard to isolate :/
For example I don't get it on my CI system, even if I think it's the same situation...
Can you reproduce it using the project I told you about? Either without the cache here and with it. If yes, then that's almost a good reproduceable thing, then nodejs people could tell us what to do to get more relevant information...

I'll try it on the weekend and see if I can reproduce the issue.

@Daniel15 any news on that? I didn't have any problem for some time but lately on my CI system, once out of 3 yarn install segfaults.
I think it is related in a way or another with the cache (because the cache is not always available from the CI).
It is with yarn 0.18.0.

Saw some cache related commits in 0.18.1, so gave that a shot.
I am not getting any segfaults anymore. Using my own docker image that imports a fix to the executable, other than that it's the latest.tar.gz from the site.
````
FROM node:alpine

MAINTAINER Sam Mousa sam@mousa.nl

We keep build-base since it is required for building node-sass.

RUN apk add --no-cache --update build-base python curl
RUN mkdir -p /opt/yarn && \
curl -L https://yarnpkg.com/latest.tar.gz | tar xzv -C /opt/yarn && \
# Import latest exec script so it allows symlink. #1678
curl -L https://raw.githubusercontent.com/yarnpkg/yarn/master/bin/yarn -o /opt/yarn/dist/bin/yarn && \
ln -s /opt/yarn/dist/bin/yarn /bin/yarn
RUN yarn global add angular-cli
````

Hi !

I don't know whether it is produced by the same area of the code but I'm also having segmentation faults with a project with an empty node_modules folder running:

~
$ yarn link "project-name"
~

I was doing it wrong because the command was run in the folder where only yarn link should be run (by "only" I mean without the actual package name). But anyway, just posting this here in case it could be useful for the debug process.

By the way, thanks for Yarn, dependency management is way cooler with it !

Im seeing the same problem when doing yarn install inside a docker building angular-cli project as well..
any updates?

We also get segfault in docker running yarn install (node:7 <- debian:jessie)

Closing due to ambiguity. Anyone having similar problems, please open a new issue with reproduction steps.

Also please make sure you are using the latest version of yarn. Thanks! โค๏ธ

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jiripospisil picture jiripospisil  ยท  128Comments

donaldpipowitch picture donaldpipowitch  ยท  75Comments

donovan-graham picture donovan-graham  ยท  115Comments

MichelDiz picture MichelDiz  ยท  80Comments

sfabriece picture sfabriece  ยท  73Comments