HotFix for Critical sync error: RangeError: Maximum call stack size exceeded #4969
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We had a case where a new storage node was doing an initial sync. The number of objects to sync was around 380,000.
Sync tasks being added was using pattern
Array.push(...tasks)
this results in a call toArray.push(....)
with 380,000 arguments which are all added to the javascript call stack which throws an exception, this resulted in the node never being able to complete a sync run.The fix is to just iterate over the tasks array elements and push them individually into the target array.