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

JavaScript heap out of memory. #4605

Closed
steabert opened this issue Oct 5, 2017 · 3 comments
Closed

JavaScript heap out of memory. #4605

steabert opened this issue Oct 5, 2017 · 3 comments

Comments

@steabert
Copy link

steabert commented Oct 5, 2017

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

bug

What is the current behavior?

When a large buffer is passed to a spy, and a check on the spy fails, jest hangs while trying to print out the failure, and eventually ends with a fatal error (heap out of memory);

sample test

The issue doesn't show when running on repl.it, but it does when I run it from the Linux command line:

node_modules/.bin/jest --runTestsByPath --no-cache test.js

When looking at the debugger, it seems it gets stuck trying to pretty format the buffer.

What is the expected behavior?

Jest prints failure in a way that doesn't cause heap out of memory.

Please provide your exact Jest configuration and mention your Jest, node, yarn/npm version and operating system.

Jest v21.2.1
Node v8.5.0
Yarn v1.0.1
OS: Linux (Debian Jessie)

@thymikee
Copy link
Collaborator

thymikee commented Oct 5, 2017

I think this is basically the same: #1772
There are plans on replacing diff algorithm with more efficient diff-match-patch.
cc: @pedrottimark who's probably on to it in the (hopefully not so distant) future

@thymikee thymikee closed this as completed Oct 5, 2017
@pedrottimark
Copy link
Contributor

Yes, it does sound similar to other issue.

Thanks for link to test case. I might have follow up questions next week.

The change to jest-diff will be diff-match-patch in addition to not instead of diff package, but the specific point of failure is concatenation loop in pretty-format package.

Root of problem is what to display when some tests fail, especially if properties of large object or contents of large buffer are not relevant.

hql287 added a commit to hql287/Manta that referenced this issue Jan 9, 2018
@github-actions
Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

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

No branches or pull requests

3 participants