thekevinbrown/react-native-schemes-manager

Javascript Heap Error on modules with circular links

Opened this issue · 3 comments

The react native schemes manager chokes loops out of control when it encounters circular symlinks within a node module.

Steps to reproduce the behavior

Install a node module with a circular link, such as react-native-http, which contains the obvious circular link:
react-native-http/example/get/node_modules/http-browserify/example/streaming/node_modules/http-browserify -> ../../..

Run react-native-schemes-manager all

Expected behavior

Script completes without error.

Actual behavior

Script meets untimely demise.

Hiding schemes from node_modules xcode projects.
iOS/XXXXXX.xcodeproj
 - [fix-script]: iOS/XXXXXX.xcodeproj skipped

<--- Last few GCs --->

[68345:0x103801e00]   151252 ms: Mark-sweep 1493.3 (1572.4) -> 1493.2 (1541.4) MB, 1981.5 / 0.7 ms  last resort GC in old space requested
[68345:0x103801e00]   153191 ms: Mark-sweep 1493.2 (1541.4) -> 1493.2 (1541.4) MB, 1938.3 / 0.4 ms  last resort GC in old space requested


<--- JS stacktrace --->

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

Security context: 0x13bb3fca58b9 <JSObject>
    1: _readdirEntries [/Users/XXXXXX/Projects/XXXXXX/XXXXXX/XXXXXX/node_modules/glob/glob.js:~559] [pc=0x70da8a28c7e](this=0x13bb3ad956f9 <Glob map = 0x13bbc89233b9>,abs=0x13bbfb9844f1 <String[392]: /Users/XXXXXX/Projects/XXXXXX/XXXXXX/XXXXXX/node_modules/react-native-http/example/get/node_modules/http-browserify/example/streaming/node_modules/http-browse...

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

This all takes place in an "example" directory; perhaps not follow those? Or possibly have an exclusion list in an environment variable? Dealer's choice. 😃

Was just about to open an issue for this 😄

We're running into the same issue with the same library (react-native-http). Patching it as shown in #67 fixed the issue

Or just remove "example" folder from react-native-http