nodejs.RangeError: Maximum call stack size exceeded when use hmset
See original GitHub issuewhen hmset get too much args(i passed 163368 args),it will report nodejs.RangeError: Maximum call stack size exceeded
Issue Analytics
- State:
- Created 5 years ago
- Comments:13 (4 by maintainers)
Top Results From Across the Web
JavaScript RangeError: Maximum Call Stack Size Exceeded
The RangeError: Maximum call stack size exceeded is thrown when a function call is made that exceeds the call stack size. This can...
Read more >nodeJs huge array processing throws RangeError: Maximum ...
The problem is that you are making to many function calls. Setting the stack-size to a higher value will only increase the number...
Read more >[Node] RangeError: Maximum call stack size exceeded - Agents
Hello,. I have an error with node.js new relic agent installed on a k8s pod along with my service. My error is listed...
Read more >RangeError: Maximum call stack size exceeded
I'm encountering this error -- "RangeError: Maximum call stack size exceeded" -- when I run a node.js app that dynamically generates a map/reduce...
Read more >JavaScript Error: Maximum Call Stack Size Exceeded
If you see the “Maximum Call Stack Size Exceeded” error, there's likely a problem with a recursive function within your JavaScript code.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I ran into this too, and I think it’s mostly a documentation issue that ioredis really should address.
Essentially, the ioredis APIs for
hmset
,hmget
, and possibly others are documented as though the arguments to the command must be passed as arguments one by one. I.e., if you want to set 100,000 hash keys, the docs suggest you’d callcommander.hmset
with 200,001 arguments (200,000 for the hash keys and their values, plus one for the redis key holding the hash). But, as noted in the OP, trying to call a method with so many arguments causes v8 to crash, because each argument gets allocated as a variable in the function’s stack frame.The simplest workaround is actually to call
commander.hmset("keyHoldingHash", my200_000ItemArray)
. This works because theCommand
class flattens it’s arguments — which is great, but that’s the part that’s totally undocumented and that it’s unclear whether callers can safely rely on. So, if that flattening is here to stay, it should be documented, probably with a note that it can be used with any command to work around this limit on the number of arguments allowed to a function call.Still encountering this issue.