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

HotFix for Critical sync error: RangeError: Maximum call stack size exceeded #4969

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions storage-node/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 3.8.1

- Hotfix: Fix call stack size exceeded when handling large number of initial object to sync.

### 3.8.0

- Changed Elasticsearch transport to use data streams instead of regular indices. Removed `--elasticSearchIndex` option and replaced with `--elasticSearchIndexPrefix`. Node ID from config will be automatically appended to the index name.
Expand Down
2 changes: 1 addition & 1 deletion storage-node/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "storage-node",
"description": "Joystream storage subsystem.",
"version": "3.8.0",
"version": "3.8.1",
"author": "Joystream contributors",
"bin": {
"storage-node": "./bin/run"
Expand Down
12 changes: 10 additions & 2 deletions storage-node/src/services/sync/workingProcess.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,16 @@ export class WorkingStack implements TaskSink, TaskSource {
}

async add(tasks: SyncTask[]): Promise<void> {
if (tasks !== null) {
this.workingStack.push(...tasks)
// Avoid using:
// this.workingStack.push(...tasks)
// When tasks array is very large, javasctipy call stack size might
// be exceeded and push() will throw an exception.
// This is pretty code:
// tasks.map((task) => this.workingStack.push(task))
// ..but slow for large array.
const len = tasks.length
for (let i = 0; i < len; i++) {
this.workingStack.push(tasks[i])
}
}
}
Expand Down
Loading