question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

nodejs.RangeError: Maximum call stack size exceeded when use hmset

See original GitHub issue

when hmset get too much args(i passed 163368 args),it will report nodejs.RangeError: Maximum call stack size exceeded

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:13 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
ethanresnickcommented, Dec 5, 2019

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 call commander.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 the Command 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.

0reactions
mstercommented, Aug 12, 2020

Still encountering this issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found