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

Node crashes when using toJson #166

Open
boatcoder opened this issue Mar 8, 2020 · 7 comments
Open

Node crashes when using toJson #166

boatcoder opened this issue Mar 8, 2020 · 7 comments
Labels

Comments

@boatcoder
Copy link

I've tried it with v10.18.1, v10.19.0 and 12.16.1 and all of them fail the same way. Not sure what is going on here. This only started once I used toJson, and quits when I don't use it.

enzyme-to-json version: v3.4.4

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
 1: 0x100080c68 node::Abort() [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
 2: 0x100080dec node::errors::TryCatchScope::~TryCatchScope() [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
 3: 0x100185167 v8::Utils::ReportOOMFailure(v8::internal::Isolate*, char const*, bool) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
 4: 0x100185103 v8::internal::V8::FatalProcessOutOfMemory(v8::internal::Isolate*, char const*, bool) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
 5: 0x10030b2f5 v8::internal::Heap::FatalProcessOutOfMemory(char const*) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
 6: 0x10030c9c4 v8::internal::Heap::RecomputeLimits(v8::internal::GarbageCollector) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
 7: 0x100309837 v8::internal::Heap::PerformGarbageCollection(v8::internal::GarbageCollector, v8::GCCallbackFlags) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
 8: 0x1003077fd v8::internal::Heap::CollectGarbage(v8::internal::AllocationSpace, v8::internal::GarbageCollectionReason, v8::GCCallbackFlags) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
 9: 0x100307cd3 v8::internal::Heap::CollectAllAvailableGarbage(v8::internal::GarbageCollectionReason) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
10: 0x1003130a6 v8::internal::Heap::AllocateRawWithRetryOrFail(int, v8::internal::AllocationType, v8::internal::AllocationOrigin, v8::internal::AllocationAlignment) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
11: 0x1002e273c v8::internal::Factory::NewRawTwoByteString(int, v8::internal::AllocationType) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
12: 0x100690a19 v8::internal::IncrementalStringBuilder::Extend() [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
13: 0x1004075c6 v8::internal::JsonStringifier::SerializeString(v8::internal::Handle<v8::internal::String>) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
14: 0x10040ba4b v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<true>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
15: 0x10040a393 v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<false>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
16: 0x100409c04 v8::internal::JsonStringifier::Result v8::internal::JsonStringifier::Serialize_<false>(v8::internal::Handle<v8::internal::Object>, bool, v8::internal::Handle<v8::internal::Object>) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
17: 0x100404f2c v8::internal::JsonStringify(v8::internal::Isolate*, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>, v8::internal::Handle<v8::internal::Object>) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
18: 0x10022886a v8::internal::Builtin_JsonStringify(int, unsigned long*, v8::internal::Isolate*) [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]
19: 0x100950a19 Builtins_CEntry_Return1_DontSaveFPRegs_ArgvOnStack_BuiltinExit [/Users/mark/.nvm/versions/node/v12.16.1/bin/node]

<--- Last few GCs --->

[58419:0x10291f000]    31010 ms: Mark-sweep 2007.8 (2079.8) -> 2007.8 (2079.8) MB, 82.0 / 0.0 ms  (average mu = 0.132, current mu = 0.002) allocation failure scavenge might not succeed
[58419:0x10291f000]    31097 ms: Mark-sweep 2007.8 (2079.8) -> 2007.8 (2079.8) MB, 86.6 / 0.0 ms  (average mu = 0.070, current mu = 0.000) allocation failure scavenge might not succeed


<--- JS stacktrace --->

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

Security context: 0x1adb17c408d1 <JSObject>
    0: builtin exit frame: stringify(aka stringify)(this=0x1adb657004b1 <undefined>,0x1adb657004b1 <undefined>,0x1adb657004b1 <undefined>,0x1adbbf33d839 <JSArray[2]>,0x1adb657004b1 <undefined>)

    1: arguments adaptor frame: 1->3
    2: writeChannelMessage(aka writeChannelMessage) [0x1adbe4cca081] [internal/child_process/serialization.js:118] [bytecode=0x1adbaa53ec61 offset=7](this=0x1adb65700...
@VincentLanglet
Copy link
Collaborator

VincentLanglet commented Mar 8, 2020

Did you try others enzyme-to-json version ? @boatcoder

@boatcoder
Copy link
Author

boatcoder commented Mar 10, 2020 via email

@boatcoder
Copy link
Author

boatcoder commented Mar 10, 2020 via email

@VincentLanglet
Copy link
Collaborator

I'm using this on node 12 without any issue...

Any ideas @adriantoine ?

@adriantoine
Copy link
Owner

Hi,

It doesn't seem to be related to this library, did you have any issues using any other node libraries? Did you try to run your tests without enzyme-to-json? Also can you provide the complete test case to reproduce the issue?

Thanks!

@boatcoder
Copy link
Author

boatcoder commented Mar 10, 2020 via email

@20BBrown14
Copy link

20BBrown14 commented Jun 20, 2020

I'm getting a very similar issue when mounting a component for snapshot testing. Tried enzyme 3.4.4 and 3.5.0 with Jest 24, 25, and 26. Tried it with using the helper toJson and with jest's snapshotSerializer config. Also tried with Node lts/dubnium and Node lts/erbium Was also able to reproduce the issue with the same config on a different machine and OS.

Repo is here: https://github.com/20BBrown14/digital-terrain-mc-js/tree/feature/add_layout

Offending test is tests/components/header/HeaderView.test.jsx

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants