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

fix(loader-utils): concatenateArrayBuffers bottleneck fix #2856

Merged
merged 1 commit into from
Jan 16, 2024

Conversation

dariaterekhova-actionengine
Copy link
Collaborator

I've got the RangeError: Maximum call stack size exceeded error for huge slpk creation. So I investigated and found out that we have a bottleneck on the current implementation of concatenateArrayBuffers function in amount of arguments. I haven't found any info about nodejs, but I've found the following article: https://stackoverflow.com/a/22747272 and it looks like node has the same limitation of max 65 535 arguments per function and throw the same error since it use the same V8 engine to interpret JS code. But number of files even in 5gb datasets can reach 800 000, so node can't handle it and throws an error.

To solve this problem I've created another function receiving ArrayBuffer[] instead of multiple arguments

@dariaterekhova-actionengine dariaterekhova-actionengine marked this pull request as ready for review January 15, 2024 11:13
@dariaterekhova-actionengine dariaterekhova-actionengine requested review from belom88 and ibgreen and removed request for belom88 January 15, 2024 11:14
Copy link
Collaborator

@ibgreen ibgreen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, classic JS pitfall.

Would be good to convert all calls to concatenateArrayBuffers.

@dariaterekhova-actionengine dariaterekhova-actionengine merged commit 17f79e9 into master Jan 16, 2024
4 checks passed
@dariaterekhova-actionengine dariaterekhova-actionengine deleted the dt/concatenate_bottleneck_fix branch January 16, 2024 16:46
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

Successfully merging this pull request may close these issues.

2 participants