Joystream / joystream

Joystream Monorepo
http://www.joystream.org
GNU General Public License v3.0
1.42k stars 115 forks source link

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

Closed mnaamani closed 10 months ago

mnaamani commented 10 months ago

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 to Array.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.