Ask coding questions

← Back to all posts
RangeError: Maximum call stack size exceeded
ReallyBasic

Having trouble with node.js. I keep getting this error:

but I am not sure what it means.

Any help will be appreciated, but I will not respond to this. Believe me, I have tried.

Comments
hotnewtop
ReallyBasic

@Coder100 @OldWizard209

Found the bug. I am afraid I have led you astray...

When using socket.io, do NOT send an object using socket.emit. I discovered that the player was sending it's entire team to the client, which apparently cannot happen.

If you ever see this issue again, this is probably why, and may help you point it out in the future.

Thanks for your help!

ReallyBasic

@Coder100 @OldWizard209

I believe the issue can be found in the src/client folder, in one of three (or all three, I'm not sure) files:

  • index.js
  • networking.js
  • state.js

Index.js handles user input. Upon loading the project, you enter your credentials and then click the 'login' button. It passes the login stuff to networking.js, which then sends the data to the server. The server responds appropriately (I know that works at least) then sends it's own info back to networking.js (whether or not the user actually signed in or not). Networking.js then hides the GUI if the player signs in successfully (it always does).

... then it breaks. The server stops, throws the error, and the client disconnects.

I put console.log at the beginning and the end of virtually every function I can think of, and none of them get called more than once.


As a side note: can you see the terminal? If you can, you can check out the error yourself. If not, fork the project, then type npm run develop in the terminal, and put virtually anything (but not nothing) in the input boxes. Hit 'login' and the game will crash.

Coder100

no we can't @ReallyBasic

ReallyBasic

You cannot see the terminal, or cannot find the problem? @Coder100

Coder100

cannot see terminal @ReallyBasic

ReallyBasic

Here:

@Coder100

Coder100

is that like a bug with how you are calling the function? Confirm you are using the function correctly, otherwise it's just a bug with a library you are using.

OldWizard209

According to StackOvrflw:

It means that somewhere in your code, you are calling a function which in turn calls another function and so forth, until you hit the call stack limit.

So go through your code and see all the places where the functions are called and change it accordingly.

For reference here is the SO post:
https://stackoverflow.com/questions/6095530/maximum-call-stack-size-exceeded-error

ReallyBasic

I have read this SO post already. I have no idea where the recursion is happening, even though I am using console.log absolutely everywhere. If you could tell me where it is happening, I will mark this as the answer.
@OldWizard209

Coder100

lolololol the error you got is called a stack overflow @ReallyBasic

OldWizard209

HAHAHAAHAA, DAMN i didnt realize that. @Coder100

OldWizard209

I have read this SO post already. I have no idea where the recursion is happening, even though I am using console.log absolutely everywhere. If you could tell me where it is happening, I will mark this as the answer.

I would, but I couldn't locate the file. If you can tell me the file path, i would tell u le solution.
@ReallyBasic