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

"react-native start" ends with "out of memory"-failure on Node >=12.5 #485

Closed
PK-INTENSIO opened this issue Jul 5, 2019 · 23 comments
Closed
Labels
bug Something isn't working help wanted

Comments

@PK-INTENSIO
Copy link

PK-INTENSIO commented Jul 5, 2019

EDIT: Workaround

Downgrade to Node 12.4, see #485 (comment).

Environment

System:
OS: Windows 10
CPU: (4) x64 Intel(R) Core(TM) i7-4510U CPU @ 2.00GHz
Memory: 5.40 GB / 7.88 GB
Binaries:
Node: 12.6.0 - C:\Program Files\nodejs\node.EXE
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
IDEs:
Android Studio: Version 3.4.0.0 AI-183.6156.11.34.5522156

Description

"react-native start" ends with "out of memory"-failure

C:\Temp\FRNA>react-native start
┌──────────────────────────────────────────────────────────────────────────────┐
│ │
│ Running Metro Bundler on port 8081. │
│ │
│ Keep Metro running while developing on any JS projects. Feel free to │
│ close this tab and run your own Metro instance if you prefer. │
│ │
https://github.com/facebook/react-native
│ │
└──────────────────────────────────────────────────────────────────────────────┘

Looking for JS files in
C:\Temp\FRNA

Loading dependency graph...
<--- Last few GCs --->

[3844:00000135069CA290] 9074 ms: Scavenge 65.9 (93.0) -> 51.0 (93.0) MB, 4.1 / 0.0 ms (average mu = 0.998, current mu = 0.998) allocation failure

<--- JS stacktrace --->

==== JS stack trace =========================================

0: ExitFrame [pc: 00007FF6C4CF170D]
1: InternalFrame [pc: 00007FF6C4C659EB]

Security context: 0x029a341c0911
2: next [0000029A341E29A9](this=0x02a8d7380881 ,0x022c4d995851 <JSArray[18398]>)
3: asyncGeneratorStep(aka asyncGeneratorStep) [000000039D6EBEA1] [C:\Temp\FRNA\node_modules\jest-haste-map\build\index.js:193] [bytecode=00000340235B2529 offset=11](this=0x00bbe6dc04d1 ,0x02a8d7380881 ...

FATAL ERROR: Zone Allocation failed - process out of memory
1: 00007FF6C44B962F
2: 00007FF6C4462376
3: 00007FF6C4463036
4: 00007FF6C4C48A1E
5: 00007FF6C4C30D6A
6: 00007FF6C4758E9D
7: 00007FF6C4F7CD34
8: 00007FF6C4F7C7AD
9: 00007FF6C4F7B3BF
10: 00007FF6C50E9C26
11: 00007FF6C50C7BD6
12: 00007FF6C4FC037A
13: 00007FF6C4FDD009
14: 00007FF6C4FDD5D4
15: 00007FF6C4FDD366
16: 00007FF6C4FC150E
17: 00007FF6C4FBEAA1
18: 00007FF6C4FBAF4B
19: 00007FF6C4B7DA77
20: 00007FF6C4B7D3D1
21: 00007FF6C4B7A4A3
22: 00007FF6C48AF317
23: 00007FF6C4CF170D
24: 00007FF6C4C659EB
25: 00007FF6C4C93585
26: 00007FF6C4C65BBC
27: 00007FF6C4C65BBC
28: 00007FF6C4CB9FC2
29: 00007FF6C4C84BB2
30: 00007FF6C4C633DC
31: 00007FF6C4B0DF24
32: 00007FF6C4B0E033
33: 00007FF6C4B0E702
34: 00007FF6C49E6A05
35: 00007FF6C4C6678C
36: 00000268F35536F3

Reproducible Demo

run "react-native init FRNA"
run "react-native start"

@PK-INTENSIO PK-INTENSIO added the bug Something isn't working label Jul 5, 2019
@thecodrr
Copy link
Contributor

thecodrr commented Jul 5, 2019

Kindly put the output of react-native --version here.

@erik-tartaglia
Copy link

I'm facing the same issue.

Just updated from node v11.7 to 12.6, and now the command "react-native start" progressively consumes the entire system memory.

OS
Linux Mint 19.1 Tessa - 4.15.0-54-generic x86_64

npm -v
6.9.0

node -v
v12.6.0

react-native --version
react-native-cli: 2.0.1
react-native: 0.60.0

Rolling back to the previous node version solves the issue

@thymikee
Copy link
Member

thymikee commented Jul 7, 2019

Interesting. Are you able to provide a repro case we can download and investigate?

@erik-tartaglia
Copy link

Interesting. Are you able to provide a repro case we can download and investigate?

It was a new empty project without any modification:

$ react-native init hello && cd hello && react-native start
This will walk you through creating a new React Native project in /home/tartagliaeg/dev/hello
Using yarn v1.16.0
Installing react-native...
yarn add v1.16.0
info No lockfile found.
[1/4] Resolving packages...
[...]

image

@thecodrr

This comment has been minimized.

@thymikee thymikee closed this as completed Jul 7, 2019
@thymikee thymikee reopened this Jul 7, 2019
@Dom-Mac

This comment has been minimized.

@thecodrr
Copy link
Contributor

thecodrr commented Jul 8, 2019

@Dom-Mac seems a problem with node rather than react-native-cli

@PK-INTENSIO
Copy link
Author

Downgrading to node v.12.4.0 solved my issue on Windows 10, too. node v 12.5.0 has the same problem as v 12.6.0.

react-native-cli: 2.0.1
react-native: 0.60.0

@thymikee
Copy link
Member

thymikee commented Jul 8, 2019

Possibly related issues in Node.js:

Closing, as that's unrelated to this CLI. Please send your detailed reports to Node.js maintainers.

@thymikee thymikee closed this as completed Jul 8, 2019
@thymikee thymikee changed the title "react-native start" ends with "out of memory"-failure "react-native start" ends with "out of memory"-failure on Node >=12.5 Jul 8, 2019
@sijad

This comment has been minimized.

@gdguesser
Copy link

I'm getting this error too, the memory consumption grows and freeze my system...
Already tried using v12.4.0 as suggested but still got the same

@stevesweets
Copy link

On osx 10.14.6 rolled all the way down to 10 to get this to work for me;

brew uninstall node
brew install node@10

@eperedo
Copy link

eperedo commented Aug 1, 2019

On windows 10 build 18362 version 12.5/12.4 still got the leak. 10.16.1 works fine.

@thymikee
Copy link
Member

thymikee commented Aug 6, 2019

There's a PR fixing it in upstream jest-haste-map package: jestjs/jest#8787. Please test it and report back if it works for you

@niieani
Copy link

niieani commented Aug 6, 2019

Actually the "fix" in jest-haste-map is just a workaround.

Here's a minimal reproduction of the node bug and a description of my findings: nodejs/node#29001

@mikehardy
Copy link
Contributor

@thymikee I must admit, I'm confused on how to try the workaround. If I follow the CONTRIBUTING doc and yarn link to a jest checkout of the patch-3 branch with the workaround, that will link in all the packages as well, so I would get the jest-haste-map modifications?

Or maybe it would be faster to checkout the branch, build it, then just copy the built JS in there (and maybe create a patch-package patch so it's sticky)? I'm going to try this as I don't have confidence in the yarn link idea

I will say I really love the way the reactxp framework distributes it's typescript and it's javascript, along with the necessary 'npm run build' command so that you can attempt hackery like this inside node_modules directly without any sort of fork/clone/build/copy messing around for quick tests - lowers the barrier to QA, but that's more of a "wouldn't it be nice..." thought for here for the future maybe :-)

@thymikee
Copy link
Member

thymikee commented Aug 9, 2019

@mikehardy since this is relatively small change I'd patch it manually in node_modules

@mikehardy
Copy link
Contributor

Workaround tested and working! status (and patch-package patch) attached to comment on PR jestjs/jest#8787 (comment)

@cfantasy74
Copy link

cfantasy74 commented Aug 15, 2019

Patch is for 24.8.0, but current module version is 24.8.1. Is it possible to get a path for the current version?

patch-package 6.1.2
Applying patches...

ERROR Failed to apply patch for package jest-haste-map at path

node_modules/jest-haste-map

This error was caused because jest-haste-map has changed since you
made the patch file for it. This introduced conflicts with your patch,
just like a merge conflict in Git when separate incompatible changes are
made to the same piece of code.

Maybe this means your patch file is no longer necessary, in which case
hooray! Just delete it!

Otherwise, you need generate a new patch file.

To generate a new one, just repeat the steps you made to generate the first
one.

i.e. manually make the appropriate file changes, then run

patch-package jest-haste-map

Info:
Patch file: patches/jest-haste-map+24.8.0.patch
Patch was made for version: 24.8.0
Installed version: 24.8.1

@mikehardy
Copy link
Contributor

mikehardy commented Aug 15, 2019

You'll have to hack it @cfantasy74 - just remove the hunk from crawlers/node.js (that file is modified for 24.8.0 but not needed for 24.8.1) and rename to the new patch version

@DanielTate
Copy link

still an issue on node 12.8.1

@mikehardy
Copy link
Contributor

@DanielTate there was nothing in the 12.8.1 changelog that would have led me to believe it would change. Here's what will cause it to change:

Could you test this on Node 12.9 and see if it fixes it for you? That would be news

@dbw03135
Copy link

@mikehardy
I tested on node lastest release (v12.10.0) and it work! thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted
Projects
None yet
Development

No branches or pull requests