Open raghuindra opened 4 years ago
same here. I rolled back to v5.0.0
Seeing same thing here for me:
RangeError: Maximum call stack size exceeded
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:30:5)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
at Function.Object.<anonymous>.Array.from [as nativeFrom] (node_modules/collections/shim-array.js:31:22)
I could not get it to work fixed a version 5.0.0 either. Had to stop using it altogether as it interferred badly with Apollo GraphQL API. This looks to be using Monkey patching which is asking for trouble.
Committed a tentative fix on master, please try it and let me know if it fixes it.
Just wanted to use collections for the first time. The algorithms implemented looked decent, but to be honest, I am quite disappointed that importing e.g. collections/sorted-map
would shim global objects. Not only because of the above error I just fell in as well, and going back to 5.0.0 did not help (it does not seem to support generators ?).
In general I find shimming of global objects like overwriting Array.from
something to be avoided. If it absolutely has to be, it should be an opt-in feature.
I do not see a need for SortedMap for example to shim anything. As shimming seems to be deeply embedded, the risk of it breaking existing code at a fundamental and global level is just too high.
We've just hit this too on 5.1.12
. Forcing the resolution to 5.0.0
has worked.
Note: We aren't using collections
directly, it is a transitive dependency via another package.
EDIT: @marchant For the sake of this issue and your request, I tried your fix on master
and it works. 👍
Dears, I have the same problem when using collections on dependancies of homebridge-alexa (in mqtt dependancies) : RangeError: Maximum call stack size exceeded at Function.Array.from (/usr/local/lib/node_modules/homebridge-alexa/node_modules/collections/shim-array.js:32:22) at Function.Array.from (/usr/local/lib/node_modules/homebridge-alexa/node_modules/collections/shim-array.js:32:22) at Function.Array.from (/usr/local/lib/node_modules/homebridge-alexa/node_modules/collections/shim-array.js:32:22) at Function.Array.from (/usr/local/lib/node_modules/homebridge-alexa/node_modules/collections/shim-array.js:32:22) at Function.Array.from (/usr/local/lib/node_modules/homebridge-alexa/node_modules/collections/shim-array.js:32:22) at Function.Array.from (/usr/local/lib/node_modules/homebridge-alexa/node_modules/collections/shim-array.js:32:22) at Function.Array.from (/usr/local/lib/node_modules/homebridge-alexa/node_modules/collections/shim-array.js:32:22) at Function.Array.from (/usr/local/lib/node_modules/homebridge-alexa/node_modules/collections/shim-array.js:32:22) at Function.Array.from (/usr/local/lib/node_modules/homebridge-alexa/node_modules/collections/shim-array.js:32:22) at Function.Array.from (/usr/local/lib/node_modules/homebridge-alexa/node_modules/collections/shim-array.js:32:22)
5.1.12 is installed but doesn't contain the if(!Array.nativeForm)
condition on line 32. but even if i use it, i still have the error (on line 35)...
the error is on the return Array.nativeFrom(values, mapFn, thisArg);
@marchant - Is it possible to get this fix pushed out as a release ?
In the homebridge community we have had numerous users of our packages impacted by this issue due to the usage of mqtt.
this fix doesn't fix the issue :( i've tried it
@NebzHB - When I was testing, I applied the fix to all the plugins leveraging collections and that appeared to resolve the issue. Did you try that
not to all of them, i'll try
well... homebridge-camera-ffmpeg seems to still use it (^4.2.8) but doesn't crash here... so with only changing homebridge-alexa, it doesn't solve. but push to release anyway, we'll see ;)
I tried to reproduce the issue using minimal code.
When I import (emulation code) version 5.1.12 once, it works fine. https://wandbox.org/permlink/hmddUMmg9KvZGz94
However, I import version 5.1.12 twice, then infinity recursive call happens. https://wandbox.org/permlink/bmniUnfwt8nqlrVB
If import order is 5.1.12 -> master, then it works fine. https://wandbox.org/permlink/a6ttiL4PrB59cnN6
If import order is master -> 5.1.12, then infinity recursive call happens. https://wandbox.org/permlink/SqR662bKByM5pou6
If import master twice, then it works fine. https://wandbox.org/permlink/NhufBWIaU42d6aa6
NOTE: master is 85f00f8776e8ece7a6dbb43c47e489d0b14eaca6
So in order to fix the issue, all of collections library need to update. (The first import is exception but depending on the order is dangerous)
After the current master including https://github.com/montagejs/collections/commit/85f00f8776e8ece7a6dbb43c47e489d0b14eaca6 fix would be released, and then all collections.js users would update the library, I guess that the issue would be fixed.
I just published the latest master as version 5.1.13.
@marchant Tks very much I just updated my test environment and can no longer recreate the issue. ( I validated that npm had installed collections 5.1.13 )
@redboltz tks for the pull request against mqtt
Main project has dependent on collections/shim-array and one of its npm package also depends upon collections/shim-array. And whenever in the code we imported(required) both packages, node js returning Maximum call stack size. Same scenario is not happening with any other such inter dependency packs like mongoose, geolib, etc.