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

RangeError: Invalid string length #234

Open
rmeissn opened this issue Nov 3, 2021 · 0 comments
Open

RangeError: Invalid string length #234

rmeissn opened this issue Nov 3, 2021 · 0 comments

Comments

@rmeissn
Copy link

rmeissn commented Nov 3, 2021

I'm using parallel.js to build up a result space and to find all criteria matching results within this space, which works very well. There is just one edge case, where this isn't working: In case my criteria are sparse (or there are no criteria, so each result of the result space is a matching result), my algorithm produces a lot of data, which are reduced to a long List of Lists. This list seems to be too long to be parsed by JSON.stringify (used by parallel.js) and raises a:

RangeError: Invalid string length
    at JSON.stringify (<anonymous>)
    at process.eval (eval at <anonymous> (.../node_modules/paralleljs/lib/eval.js:7:5), <anonymous>:23:30329)
    at process.emit (node:events:390:28)
    at emit (node:internal/child_process:917:12)
    at processTicksAndRejections (node:internal/process/task_queues:84:21)

This is caused by an issue of the V8 engine, used by Node.js:
nodejs/node-v0.x-archive#14170
nodejs/node#35973
and it seems this won't get fixed within the near future.

The mentioned solution is

Consider processing the JSON chunk, by chunk as it comes in, rather than trying to load it all into a string and then parsing it.

which I can't apply, as parallel.js is executing the stringify operation.

Is there an option to work around this issue or to fix it within parallel.js?

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

No branches or pull requests

1 participant