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

Sometimes Nx commands fails with segmentation fault #2956

Closed
4 tasks done
gperdomor opened this issue May 5, 2020 · 17 comments
Closed
4 tasks done

Sometimes Nx commands fails with segmentation fault #2956

gperdomor opened this issue May 5, 2020 · 17 comments

Comments

@gperdomor
Copy link
Contributor

Please make sure you have read the submission guidelines before posting an issue

Prerequisites

Please answer the following questions for yourself before submitting an issue.
YOU MAY DELETE THE PREREQUISITES SECTION.

  • I am running the latest version
  • I checked the documentation (nx.dev) and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository (not related to React, Angular or any dependency)

Expected Behavior

Commands run without error

Current Behavior

nx affected:build --all

>  NX   WARNING  Running affected:* commands with --all can result in very slow builds.

  --all is not meant to be used for any sizable project or to be used in CI.
  
  Learn more about checking only what is affected: https://nx.dev/guides/monorepo-affected.


>  NX  Running target build for projects:

  - console
  - api

———————————————————————————————————————————————

> ng run console:build 

>  NX   NOTE  Cached Output:

Generating ES5 bundles for differential loading...
ES5 bundle generation complete.

chunk {runtime} runtime-es2015.js, runtime-es2015.js.map (runtime) 6.16 kB [entry] [rendered]
chunk {runtime} runtime-es5.js, runtime-es5.js.map (runtime) 6.16 kB [entry] [rendered]
chunk {polyfills} polyfills-es2015.js, polyfills-es2015.js.map (polyfills) 142 kB [initial] [rendered]
chunk {styles} styles-es2015.js, styles-es2015.js.map (styles) 13.3 kB [initial] [rendered]
chunk {styles} styles-es5.js, styles-es5.js.map (styles) 14.9 kB [initial] [rendered]
chunk {main} main-es2015.js, main-es2015.js.map (main) 60.1 kB [initial] [rendered]
chunk {main} main-es5.js, main-es5.js.map (main) 63 kB [initial] [rendered]
chunk {polyfills-es5} polyfills-es5.js, polyfills-es5.js.map (polyfills-es5) 784 kB [initial] [rendered]
chunk {vendor} vendor-es2015.js, vendor-es2015.js.map (vendor) 2.8 MB [initial] [rendered]
chunk {vendor} vendor-es5.js, vendor-es5.js.map (vendor) 3.27 MB [initial] [rendered]
Date: 2020-05-05T13:50:41.861Z - Hash: 4f7fcabf57b857131bc5 - Time: 18519ms

> ng run api:build 

>  NX   NOTE  Cached Output:

Starting type checking service...
Using 6 workers with 2048MB memory limit
Hash: f4a903e194e997656273
Built at: 05/05/2020 9:50:18 AM
Entrypoint main = main.js main.js.map
chunk {main} main.js, main.js.map (main) 2.33 KiB [entry] [rendered]

———————————————————————————————————————————————

>  NX   SUCCESS  Running target "build" succeeded

  Nx read the output from cache instead of running the command for 2 out of 2 projects.

[1]    6222 segmentation fault  nx affected:build --all

Failure Information (for bugs)

The problem maybe be cache related, with --skip-nx-cache flag the problem is gone for some commands like nx affected:xxxxx but not for run-many.

nx run-many --target=lint --projects=api-interfaces --parallel --maxParallel 2 --skip-nx-cache fails too

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. step 1
  2. step 2
  3. ...

If you can provide steps to reproduce from scratch, that would be enormously appreciated (i.e. where the first step is npx create-nx-workspace@latest repro-workspace)

Context

Please provide any relevant information about your setup:

  • version of Nx used (Please run nx report at the root of your workspace and copy the results here if you are using Nx 8.6.1 or greater)
  • 3rd-party libraries and their versions
  • and most importantly - a use-case that fails

A minimal reproduction scenario allows us to quickly confirm a bug (or point out coding problem) as well as confirm that we are fixing the right problem.

Failure Logs

Please include any relevant log snippets or files here.

Other

Any other relevant information that will help us help you.

@gperdomor
Copy link
Contributor Author

@brandonroberts check this pipeline https://gitlab.com/gperdomor/platform/pipelines/144193503

Some jobs fails... Here an example

Running with gitlab-runner 12.10.0-rc2 (6c8c540f)
2   on docker-auto-scale 0277ea0f
3
Preparing the "docker+machine" executor
00:38
4 Using Docker executor with image node:14.1 ...
5 Pulling docker image node:14.1 ...
6 Using docker image sha256:a511eb5c14ecd01783c38192f572463a0fa039554494bfe76462843c04c45000 for node:14.1 ...
8
Preparing environment
00:05
9 Running on runner-0277ea0f-project-17109186-concurrent-0 via runner-0277ea0f-srm-1588961284-8b32dd02...
11
Getting source from Git repository
00:01
12 $ eval "$CI_PRE_CLONE_SCRIPT"
13 Fetching changes...
14 Initialized empty Git repository in /builds/gperdomor/platform/.git/
15 Created fresh repository.
16 From https://gitlab.com/gperdomor/platform
17  * [new ref]         refs/pipelines/144193503 -> refs/pipelines/144193503
18  * [new branch]      feature/builders         -> origin/feature/builders
19  * [new branch]      feature/cleanup          -> origin/feature/cleanup
20  * [new branch]      master                   -> origin/master
21 Checking out 5d4fed2f as feature/cleanup...
22 Skipping Git submodules setup
24
Restoring cache
00:18
25 Checking cache for node-0dae80e1c476185f189efd42443588a744e03da2...
26 Downloading cache.zip from https://storage.googleapis.com/gitlab-com-runners-cache/project/17109186/node-0dae80e1c476185f189efd42443588a744e03da2 
27 Successfully extracted cache
29
Downloading artifacts
00:02
31
Running before_script and script
00:21
32 $ node $CI_PROJECT_DIR/tools/scripts/ci/calculate-commands.js $CI_COMMIT_BRANCH > COMMANDS.json
33 $ export COMMANDS=$(cat COMMANDS.json)
34 $ node $CI_PROJECT_DIR/tools/scripts/ci/run-many.js "$COMMANDS" lint$CI_NODE_INDEX lint
35 >  NX  Running target lint for projects:
36   - api
37 ———————————————————————————————————————————————
38 > ng run api:lint 
39 Linting "api"...
40 All files pass linting.
41 ———————————————————————————————————————————————
42 >  NX   SUCCESS  Running target "lint" succeeded
43 Segmentation fault (core dumped)
44 child_process.js:650
45     throw err;
46     ^
47 Error: Command failed: npx nx run-many --target=lint --projects=api --parallel  --maxParallel 2
48     at checkExecSyncError (child_process.js:611:11)
49     at execSync (child_process.js:647:15)
50     at Object.<anonymous> (/builds/gperdomor/platform/tools/scripts/ci/run-many.js:11:3)
51     at Module._compile (internal/modules/cjs/loader.js:1176:30)
52     at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
53     at Module.load (internal/modules/cjs/loader.js:1040:32)
54     at Function.Module._load (internal/modules/cjs/loader.js:929:14)
55     at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
56     at internal/main/run_main_module.js:17:47 {
57   status: 139,
58   signal: null,
59   output: [ null, null, null ],
60   pid: 366,
61   stdout: null,
62   stderr: null
63 }
65
Running after_script
00:01
67
Uploading artifacts for failed job
00:02
69 ERROR: Job failed: exit code 1

Line 42 --> NX SUCCESS Running target "lint" succeeded
But line 43 --> Segmentation fault (core dumped)

@gperdomor
Copy link
Contributor Author

@brandonroberts the problem seems to be the node version, the fails occurs in node 14, with node 13 everything works fine

@xmlking
Copy link
Contributor

xmlking commented May 10, 2020

same for me with node v14
image

@leon
Copy link
Contributor

leon commented Jun 1, 2020

Same for us with Node 14
Node 12 works fine

@AlexAegis
Copy link

Can confirm that the cache goes wild on node 14, but switching back to 12, it reads from the cache just fine. I've been using node 14 since the start of this project, so it's not like I changed versions mid-way.

@MaSpeng
Copy link

MaSpeng commented Jun 17, 2020

Same problem here, up to Node 14.4 👎 the segmentation fault error occurs, with Node 12.18 👍 it is "gone". I hope you will be able to solve the source of this faulty behavior.

@albohlabs
Copy link

albohlabs commented Jun 17, 2020

Solved it by increasing the maximum size of the "old space" heap up to 4gb

"nx": "node --max_old_space_size=4096 ./node_modules/.bin/nx"

Edit: sry, does not have any impact

@SalathielGenese
Copy link

SalathielGenese commented Jun 29, 2020

I'll drop my experience here. It will potentially hep for more infos.

$ node -v
v14.1.0
$ yarn -v
1.22.4

@dimamarksman
Copy link

The same for me, can't build by node 14

@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions github-actions bot added the stale label Jul 31, 2020
@tianzhich
Copy link

Any progress here?🧐

@fuerst
Copy link

fuerst commented Sep 7, 2020

Using Node v14.9.0 and Nx 10.0.7 it now builds without the "segmentation fault" error.

@lucamjj
Copy link

lucamjj commented Sep 15, 2020

Using Node v14.9.0 and Nx 10.0.7 it now builds without the "segmentation fault" error.

I confirm this works.

@github-actions github-actions bot removed the stale label Nov 9, 2020
@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@pranav-js
Copy link

this is happening again with node 18.15 now

@FilipSwiniarski
Copy link

Happens again in docker node 18.5 alpine.

@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests